This week's book giveaway is in the OCMJEA forum.
We're giving away four copies of OCM Java EE 6 Enterprise Architect Exam Guide and have Paul Allen & Joseph Bambara on-line!
See this thread for details.
The moose likes Struts and the fly likes how to render the path in struts html file attribute Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCM Java EE 6 Enterprise Architect Exam Guide this week in the OCMJEA forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "how to render the path in struts html file attribute" Watch "how to render the path in struts html file attribute" New topic
Author

how to render the path in struts html file attribute

venkateshwar rao ravula
Greenhorn

Joined: Apr 03, 2006
Posts: 15
Hi All,
I am using <html:file property="theFile"> in jsp page from there i am uploading the image.in the actionform i have FormFile theFile.when i submit the jsp page the filepath is vanishing how to render that file path in the <html;file>.

Any one cam help me how instantiate FormFile.

Thanks

Venkateshwar Rao Ravula
Merrill Higginson
Ranch Hand

Joined: Feb 15, 2005
Posts: 4864
I'm afraid you can't specifiy a pre-loaded value in this field. Neither Internet Explorer nor Firefox browsers will accept any server-side value in a file upload input control. It's a security issue.

Think about it. If it were possible to specify a server-specified value here, what would prevent a malicious website from pre-loading this field with the path where your Outlook file (containing all your personal information) is likely to be located, then having JavaScript submit the page before you even knew what was happening?


Merrill
Consultant, Sima Solutions
venkateshwar rao ravula
Greenhorn

Joined: Apr 03, 2006
Posts: 15
Thanks Merrill

I am storing the path in a hiden field.is there any way of converting that to FormFile object.

Thanks & Regards,

Venkateshwar Rao Ravula
Merrill Higginson
Ranch Hand

Joined: Feb 15, 2005
Posts: 4864
Originally posted by venkateshwar rao ravula:
I am storing the path in a hiden field.is there any way of converting that to FormFile object.

No, I don't think so. The FormFile object has to contain the entire uploaded file, not just its path.

If you absolutely, positively have to get past this restriction, you might want to consider creating a signed applet to do your upload. With a signed applet, you can do pretty much whatever you want as far a defaults, remembering the last upload, etc.
 
 
subject: how to render the path in struts html file attribute