This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes Struts and the fly likes population Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "population" Watch "population" New topic
Author

population

Giomar Guevara
Ranch Hand

Joined: Oct 18, 2006
Posts: 51
How can I populate a <nested:file> tag after having an error?
Merrill Higginson
Ranch Hand

Joined: Feb 15, 2005
Posts: 4864
You can't. Both Internet Explorer and FireFox prevent the server-side from putting any kind of default in a file upload control.

It's a security issue. Think about it: If this was allowed, what would prevent a malicious website from setting the default upload file as say, your Outlook address file and then using JavaScript to submit the form automatically?

If you have other fields on the page that need to be validated, I'd suggest using client-side code (JavaScript) to do the validation. That way if an error is discovered, the page is not refreshed and the file name the user selected is still there.
[ March 07, 2007: Message edited by: Merrill Higginson ]

Merrill
Consultant, Sima Solutions
Giomar Guevara
Ranch Hand

Joined: Oct 18, 2006
Posts: 51
ok thanks
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: population
 
Similar Threads
Popup window using Struts
Comparable And Comparator usage in real time
dropdown from database
WA #1.....word association
I have no sympathy for the Iraqis