• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

File i/o

 
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I have a pretty simple JSF app. At one stage I want to generate a text file to store some simple values.

Can't rally figure out how to do it from JSF. I know its probably a dumb question but I have very little experience with web programming.

Any help would be greatly appreciated.
 
Ranch Hand
Posts: 15304
6
Mac OS X IntelliJ IDE Chrome
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
No part of your JSF code should ever handle File I/O directly. You should use a helper/business class to do this for you and then call that class' method(s) from your backing bean (controller).

Look into writing a text file with Java and forget about JSF. Then, take the code you've written and call it from your backing bean. We have an IO And Streams forum in case you need to ask specific questions about IO.
 
stuart broomfield
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hi and thanks for the feedback.
I am attempting this from a backing bean alright but am not getting anywhere. dont i need to get a facescotext and use that somehow?

thanks
 
Gregg Bolinger
Ranch Hand
Posts: 15304
6
Mac OS X IntelliJ IDE Chrome
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by stuart broomfield:
hi and thanks for the feedback.
I am attempting this from a backing bean alright but am not getting anywhere. dont i need to get a facescotext and use that somehow?

thanks



You might just try what I already suggested. Why do you think you need to get the faces context and "use that somehow"?
 
Saloon Keeper
Posts: 27763
196
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
My general rule for JSF software development:


If you have to include a javax.faces class in your backing bean, you're probably trying to do something the hard way.



I try to break it as rarely as possible.

 
Sunglasses. AKA Coolness prosthetic. This tiny ad doesn't need shades:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic