Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

[HELP] Write Object to File from JSF page

 
Alfonsus Hartanto
Greenhorn
Posts: 20
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Guys, I am newbie in JSF and now I really get stuck on this topic. I want to make such a simple data table that get value from List, but to make it stored, i want to write it to a file. This is what i have:



The page works, but it didn't write any file. Is it correct to put action listener there? or just put action only? Can anyone give me suggestion, or any references so that I can read and write file from JSF page? Thanks

Regards,


Alfonz Jan Frithz
 
Alfonsus Hartanto
Greenhorn
Posts: 20
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
still waiting for help...
 
Tim Holloway
Saloon Keeper
Pie
Posts: 18009
47
Android Eclipse IDE Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You specified a relative filename in your File constructor. Probably a file got written, but not where you thought it was being written. You're better off giving an absolute filename path.

Also, don't try to write the file into your WAR or any of its subdirectories. Even when it works, it's very bad practice. Use a directory outside of the webapp.
 
Alfonsus Hartanto
Greenhorn
Posts: 20
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Tim Holloway wrote:You specified a relative filename in your File constructor. Probably a file got written, but not where you thought it was being written. You're better off giving an absolute filename path.

Also, don't try to write the file into your WAR or any of its subdirectories. Even when it works, it's very bad practice. Use a directory outside of the webapp.


Thanks Tim, finally, I get it work. You were right, when i put the absolute path, it works. Again, thanks...
Btw, I like your quote... hahahahhahah
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic