Suppose I have a registration form that spans multiple pages( say, 1-initial, 2-detail and 3-confirmation). At the Initial page, the user would like to upload a few documents from his local disk( like email attachments). But I need to save these documents only when he successfully completes page 2 and confirms on page 3(confirmation). What is the best strategy to follow here? Does struts provide any easy mechanism?
what i am going to implements is something like this.
The use specifies the multiple documents that he wants to upload in first page( their URI(local) uri is saved in a string collection of the FormBean that would span all three pages). in third page, I will have a hidden set of file upload controls, with value set as - value from String collection of form bean. Now, i can handle this on last confirm page submit.
Any thoughts?
TIA
pepper
-
File upload problem (4 messages)
- Posted by: sgt pepper
- Posted on: November 24 2003 10:36 EST
Threaded Messages (4)
- File upload problem by Nagsen Chankapure on November 24 2003 12:37 EST
- Any more views? by sgt pepper on November 24 2003 14:50 EST
-
Any more views? by Nagsen Chankapure on November 24 2003 05:20 EST
- Any more views? by siddhu rao on November 24 2003 06:06 EST
-
Any more views? by Nagsen Chankapure on November 24 2003 05:20 EST
- Any more views? by sgt pepper on November 24 2003 14:50 EST
-
File upload problem[ Go to top ]
- Posted by: Nagsen Chankapure
- Posted on: November 24 2003 12:37 EST
- in response to sgt pepper
Yes, Struts does provides an easy mechanism to upload files. Check out <html:file> tag and/or their upload example that comes with the distribution. In your case you might have to store the form bean ( contains file(s) data) in the session but it has some drawbacks. If the user uploads huge files, lot of memory would be consumed. Or you could store it on a filesytem but you will have to keep track of the files.
If I would have a choice, I would provide interface to upload files after confirmation. Well, thats just me. -
Any more views?[ Go to top ]
- Posted by: sgt pepper
- Posted on: November 24 2003 14:50 EST
- in response to Nagsen Chankapure
Hi there thank you for your message.
I dont have a choice but to make the upload in 1st or 2nd page.
I was just wondering if instead of storing the whole File in session, what if I store the local file URIs in the session and make use of them in the last page -
Any more views?[ Go to top ]
- Posted by: Nagsen Chankapure
- Posted on: November 24 2003 17:20 EST
- in response to sgt pepper
I don't know how you plan to implement getting the files from the client machine. Only way i know is to use is signed applet that would retrieve the files from the stored local file URLs. Again, there is complexity involved to sign the applet and stuff. Definetly not a best approach.
I don't see any other option. Your best bet would be to read the file and write to the disk and process to next page. -
Any more views?[ Go to top ]
- Posted by: siddhu rao
- Posted on: November 24 2003 18:06 EST
- in response to Nagsen Chankapure
I think, u can store all those documents into an XML (may be by reading a file and placing it between two CDATA tags..), then u can store this XML object in memory.. i am not sure of the performance impacts, however this is another way of doing :->
Sridhar