File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Struts and the fly likes html:file tag and custom image Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Make it so: Java DB Connections & Transactions this week in the JDBC forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "html:file tag and custom image" Watch "html:file tag and custom image" New topic

html:file tag and custom image

Elie Hirschman
Ranch Hand

Joined: Dec 15, 2005
Posts: 37
Hi there!
I am newish to Struts and have not found a way to allow a custom image appear for the browse button when using in a form.
Here is the code I have tried in my jsp:

Can anyone help?
Elie Hirschman
Ranch Hand

Joined: Dec 15, 2005
Posts: 37
I could not accomplish this. So I gave up.
Merrill Higginson
Ranch Hand

Joined: Feb 15, 2005
Posts: 4864
Here is a link to the same question posed in another forum. The respondent shows a clever way to do this. I haven't tried it, but you might want to give it a go.

Since you're using Struts, you could replace their line:

<input type="file" name="browse" style="display:none;">


<html:file property="theFile" style="display:none;" />

Just make sure you replace all references to "browse" in their javascript with "theFile".

Consultant, Sima Solutions
It is sorta covered in the JavaRanch Style Guide.
subject: html:file tag and custom image
It's not a secret anymore!