Writing to a file help
Hello all,
this is my first message to the forums, and I'm posting here because I have run into a problem developing my first Java based web app.
I would like to have data that is submitted be written to a file.
To do so I have the JSP page access its corresponding JavaBean.
One of the methods that is called along the way in the JavaBean has been set up to write to a file using a PrintWriter object.
The file however is never generated. I tried the code with a java project and it works fine, outputing the file as I'd expect.
Is there something I should be doing differently when trying to do the same thing using JSPs and JavaBeans?
For reference I am using Eclipse with the facesIDE plugin (is there something better for working with JSF, or is this a good plugin?)
Thanks,
-Alex
[850 byte] By [
mon.goosea] at [2007-11-27 6:52:48]

# 2
I had been thinking about that. This being my first web application I'm not entirely sure that I understand exactly how the applications are deployed in the web server. I'm on OS X though, and I figured that wherever the file is written, spotlight would be able to find it, and doing a search for the file didn't reveal it to exist anywhere.
To be more relevent, part of the JavaBean looks like so:
String toPrint = "string sample";
PrintWriter out = new PrintWriter(file);
out.println("The sample string is: " + toPrint);
out.close();
return "The JavaBean has written "+toPrint+" to the file "+file;
this method [getWriteFile()] throws IOException which is not included above
to call the method I have a tag like this:
<h:outputText id="beanResponse" value="#{FileWriter.writeFile}"/>
I feel like I'm really gluing things together here, there must be a better way to call a JavaBean method.
Thanks again.
# 4
My requirements for now are simply that I take a string as an input from one JSP page using the backing bean's mutator methods, and then somehow use that bean (or any other method you may recommend) to write this string to a file.
I realise there is probably a better way to go about this, but I have about one week of experience on the JSF framework, I hope I'll be able to learn more soon ;)
-Alex