• 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

Input file JSF programatically

 
Greenhorn
Posts: 18
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello!

How can I add an inputFile or input type="file" from a managedBean? I managed creating every uicomponent that i needed using javax.faces.component from J2EE6, that is the version that I must work, even though it has been created in the J2EE7, I cant upgrade yet.

So, has anyone done this or have any tips? Html native or faces native submit file would fit to me, but I'm not managing to find how to.

 
Saloon Keeper
Posts: 27762
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
The core JSF tagset did not include a file upload control until JSF version 2.2. Before that, you would have either had to use brute-force HTML (which doesn't pair well with JSF forms) or use an extension tagset such as RichFaces or IceFaces.

I've used the RichFaces one once or twice and it was very nice.
 
Andre Froes
Greenhorn
Posts: 18
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
If I could I would, but the only thing that i have is primefaces, that is good enough, but somethings are still to come :D . Well, i managed doing the input type="file", not perfeclty, but it fits at the moment, but now, my commandButton is not performing the action that it is binded to, this is annoying me hehe. It is not even acessing the method.
 
Tim Holloway
Saloon Keeper
Posts: 27762
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

Andre Froes wrote:If I could I would, but the only thing that i have is primefaces, that is good enough, but somethings are still to come :D . Well, i managed doing the input type="file", not perfeclty, but it fits at the moment, but now, my commandButton is not performing the action that it is binded to, this is annoying me hehe. It is not even acessing the method.



http://www.primefaces.org/showcase/ui/fileUploadSingle.jsf

Note that in JSF, if ANY control on a form has an invalid value, the entire form is rejected and the action does not fire. The exception to that rule is if you do a partial form submit using AJAX, in which case only the submitted control values have to be valid.
reply
    Bookmark Topic Watch Topic
  • New Topic