This week's book giveaway is in the OCAJP 8 forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line! See this thread for details.
Thanks for the reply on the JAR files in a previous thread. That problem has been fixed for now.
I have another question. How do you write to or read from data files in a JSF project an Eclipse? I want to have a folder called, say data, immediately below the project folder, into which I can read and write files. If I use dir.getCanonicalPath() or System.getProperty("user.dir") to find the location of the default folder, I found that it is in the config folder of the Glassfish server I am using with Eclipse and JSF. This is not what I want.
but I can never get something like that to work, because either an abstract class is used or an interface.
An example of my code is here:
In this particular case it is complaining that getCcontext() is undefined. Various attemps to sort this out have so far failed, and I have spent quite a lot of time on this, so some help would be most appreciated. I am sure there is something that has to be done correctly concerning how ServletContext must be declared correctly.
This is a JSF 1.2 application that I want to modify, before moving to JSF 2.0.
Don't store data files inside your webapp. It's a violation of the J2EE standard, won't work on all webapp servers, and when it does, sooner or later, it will bite you. Use an independent directory for data that's located somewhere outside both the webapp (WAR) and the webapp server.
An IDE is no substitute for an Intelligent Developer.
Joined: Dec 12, 2007
OK, many thanks for your helpful advice. I am now instead going to use a folder in my desktop using System.getProperty("user.home") to get the path, then appending \Desktop and \Folder-Name to store the data files as a temporray measure for development and testing. Eventually this will be changed when the code will be moved onto an online server.