It's not a secret anymore!*
The moose likes Struts and the fly likes <html:file> tag? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "<html:file> tag?" Watch "<html:file> tag?" New topic

<html:file> tag?

Mallik Avula
Ranch Hand

Joined: Nov 30, 2006
Posts: 86
Hi all,
i have a page where user can upload some images. for this i am using <html:file> tag and i am able to upload it into server. Everything is fine for now.
But when the user didn't fill a mandatory item and the page get back with errors, i want to show the file path in that box.
it is not showing the 'value' attribute content in the box.
How can i do it?
Please give some suggestions.

Thanks & Regards<br />Mallik Avula<br />SCJP1.4
Merrill Higginson
Ranch Hand

Joined: Feb 15, 2005
Posts: 4864
Sorry, but there's no way that I know of to do this. For security reasons, neither Firefox nor IE allow a server-side value to be defaulted in an <input type="file" > tag (which is what html:file gets rendered as). Think about it. If this were allowed, a malicious site could default the value of your Outlook file with all your names and addresses in it and have JavaScript submit the upload before you were even aware anything was happening.

Consultant, Sima Solutions
It is sorta covered in the JavaRanch Style Guide.
subject: <html:file> tag?
Similar Threads
Want to make html:file tag readonly
html:file , setting default file type for choosing
how to upload multiply file using struts 1.1?
Is it possible to make a file chooser in struts?
html:file tag