File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes JSF and the fly likes File input with input type=file? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » JSF
Bookmark "File input with input type=file?" Watch "File input with input type=file?" New topic
Author

File input with input type=file?

Mark Dragan
Greenhorn

Joined: Sep 28, 2010
Posts: 18
Hi everyone,
I have question regarding uploading file, I'm using Jsf 2.0 and xhtml and I must provide user to create Pdf and in that Pdf to insert image, so I found the contol input and I'm
wondering when user selects image from the comp. the path is displayed in textbox of input control but how can I get that path in my Bean.
Thanks
Ilari Moilanen
Ranch Hand

Joined: Apr 15, 2008
Posts: 198
You question is hard to understand. Can you rephrase your question?

If you are asking how can you upload a file with JSF then I recommend that you use some JSF tag library that supports it. For example I use MyFaces Tomahawk that has a easy to use inputFileUpload tag.

But if you must use the normal html input type then you can either implement the receiving side by yourself or use (yet again) some third party library that can handle uploaded files.

I must say that the first approach is a lot simpler...
Mark Dragan
Greenhorn

Joined: Sep 28, 2010
Posts: 18
Thanks for reply can you post me some link regarding how is that done with myFaces input file control.
Ilari Moilanen
Ranch Hand

Joined: Apr 15, 2008
Posts: 198
taglib api
http://myfaces.apache.org/tomahawk-project/tomahawk20/tlddoc/index.html

tag
http://myfaces.apache.org/tomahawk-project/tomahawk20/tlddoc/t/inputFileUpload.html

tomahawk
http://myfaces.apache.org/tomahawk/index.html

and (finally) instructions
http://wiki.apache.org/myfaces/Setup_For_File_Uploads


If you use the JSF 2.0 remember to use the latest version of tomahawk (1.1.10 or 1.1.11-snapshot)

EDIT: and while using the instructions modify the filter mapping so that it catches calls to jsf pages instead of "shtml".
Mark Dragan
Greenhorn

Joined: Sep 28, 2010
Posts: 18
Thanks, I have downloaded myFaces but I cannot see the way to include them into xhtml project,
when I set xmlns:t="http://myfaces.apache.org/tomahawk" I only get inputhtml component, but when I create another jsp page inside same project I can all components inside that page, any reason for that.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: File input with input type=file?
 
Similar Threads
Accessing images from another path in UNIX
How do I get the relative path if the user selects a file in a JFileChooser?
accepting image path from user
Problem with image as submit button
Image Display problem