Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Input file JSF programatically  RSS feed

 
Andre Froes
Greenhorn
Posts: 18
  • Mark post as helpful
  • send pies
  • 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.

 
Tim Holloway
Bartender
Posts: 18531
61
Android Eclipse IDE Linux
  • Mark post as helpful
  • send pies
  • 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
  • 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
Bartender
Posts: 18531
61
Android Eclipse IDE Linux
  • Mark post as helpful
  • send pies
  • 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.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!