File Upload Problem in JSF
Hi all,
I have a problem in file upload. I have a file upload third party component which uploads the file with the filter action depending on the url. My requirement is to trace the uploaded filename for addressing it with the database record. So I need the filename in my backing bean to store it in the database. Ho can i get the filename from view page to backing bean. Any Ideas and help please.
Many thanx,
vijaycanaan
# 2
Mr BalusC,
I got the code from the internet and perhaps it may be a tutorial for file upload in JSF.Sorry I have mentioned as the third party component which is wrong in saying that. Again I have searched for that tutorial and not able to find that tutorial url . In that tutorial there is file upload component which is having a value attribute which takes the predifined file name. By doing so iam getting the problem with file extension. In order to solve this I should be able to get the original file name in mybacking bean for persistance storge of file name. The problem is I should be able to access the key value pairs from the view page into my backing bean. Another alternative way is to paste my code. If I do so no body is giving reply. Please Try to understand my problem.
I need the solution for this.
The problem is I have to access the components from view page which is possible in jsp from request parsing which results the key value pairs of the form components. This same thing/way I should get in backing bean from JSF view page.
Many thanx,
vijaycanaan.
# 3
I understand you. But you still haven't told which component exactly you're talking about, so I can't help you any much further in detail. There are several file upload components available: Tomahawk, IBM JSF Core, Oracle ADF, Sun Blueprints, etc. Or are you talking about a custom made upload component?
MyFaces/Tomahawk has a good uploadcomponent, the t:inputFileUpload.
Main page: http://myfaces.apache.org/tomahawk/fileUpload.html
Wiki page with useful links: http://wiki.apache.org/myfaces/File_Upload
This links to an in-depth article to understand the concept of "uploading files": http://www.onjava.com/pub/a/onjava/2005/07/13/jsfupload.html
Complete summary of required jar's and code: http://www.mail-archive.com/users@myfaces.apache.org/msg28269.html
# 4
Mr BalusC,
Yes Iam talking about a custom made upload component. The fileupload tutorials u send are good but my requirement is not meeting them. Among my requirements one is mutilple file uploads in the single view page. This is possible at present with my custom upload componet. Only if the problem gets solved. Any way once again please think on my problem and give your solution on it.
Here is my problem:
The problem is I have to access the components from view page which this kind of requirement possible in jsp by request parsing which results the key value pairs of the form components. This same thing/way I should get in backing bean from JSF view page.
The solution I want may like as follows.
Note this code is incorrect and wrong but for to understand my requirement.
someobject.getComponentIdValue("clientID"); which returns a string value as d:\images\Tutle.jpg
The clientID is upload file component' Id . In the request it may be the key associated with value as file complete path. By this kind of way my upload filter is able to get the orignal file. Ok i need this in my backing bean to get the orignal filename to insert into the database. Please for this give the solution or reply.
many thanx,
vijaycanaan.