as the title of my question states, I need to figure out a way to write the contents of a JSF inputText to a file. I want to build a small UI which will offer the user the posibility to write some math formulas in an easier way(hence the UI) and be able to save them to a .txt (or something similar) file. I have been trying for about 8-10 hours now and the best i've got is:
And the Bean:
I'm pretty sure most of what i did there is wrong so any help would be appreciated, even if it is some directions to posts which treat simmilar issues so i can try and get it from there. I don't want to be spoonfed or anything, the problem is i have never worked with JSF(i started reading about it yesterday) so as i said, even some links to some documentation which could help me(i've been googling like crazy since i started) or guide me a bit will be greatly appreciated.
Your code is not as much wrong as you think, you demonstrate to have read the JSF documentation and is correctly wiring the view with its respective bean, as shown in the code.
I've recently achieved what you want as follows:
I first created an array of bytes to store the text I wanted:
One note is that "listaLinhasArquivo" in the code above had all the text I wanted, data gathered with the help of the class StringBuilder, something specific to my scenario.
After creating the array of bytes, I created a file called "marcos.txt" on the server and filled it with the data of my array, as follows:
With that code, I successfully created a file on the server with the content I wanted. In your scenario, try to replace the content of the 'try' block for something similar and check to see if it works for you.
DJ aspirant, Engineering undergraduate, Tokusatsus addicted, fond of English language and Asia's, Buddhist, blogger, etc. I'll need to insert all these attributes in a Java class and manage to create methods for handling my overwhelming life
Joined: Aug 07, 2011
Thanks, it worked . Now I'm working on adding the selected values from a couple of "selectOneMenu's" to the file.