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


Win a copy of Soft Skills this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Issue with [html:file] tag " Watch "Issue with [html:file] tag " New topic
Author

Issue with [html:file] tag

Tuhin Ghosh
Ranch Hand

Joined: Oct 11, 2006
Posts: 33
HI..,
Am using struts ... to build a content management system
I am Using <html:file></html:file> tag to get the file from the local system
Everything 's working fine in the Action
How ever on reload the page is displayed without any File name which was selected earlier....
On viewing soutce of the page
I found the "file name" in the <html:file value="c:/desktop/abc.xsl"></html:file>
My question is
1) If i am setting the value in the struts property file
Why its not displaying...?
2) In case there is any other way to resolve the issue...Explain


Thanks in advance

Tuhin

[ September 23, 2007: Message edited by: Tuhin Ghosh ]
[ September 23, 2007: Message edited by: Tuhin Ghosh ]
Merrill Higginson
Ranch Hand

Joined: Feb 15, 2005
Posts: 4864
Even though the <input type="file" > HTML element accepts a value attribute, neither Internet Explorer nor FireFox will display any value set on the server-side in this control. In short: There's no way have a value placed in this control when the page is refreshed.

It's a security issue. If it were allowed, what would prevent a malicious website from populating this field with the name of your Outlook file with all your contacts and then having JavaScript submit the page before you even knew what was happening?

About the only way I know to work around this would be to use an Applet for your upload. If you look around, I suspect you will find some already written for this purpose.


Merrill
Consultant, Sima Solutions
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Issue with [html:file] tag