Struts 1.1 - Problem with html:cancel tag and using graphic button
Posted on 2004-08-25
I am creating a web app using Tomcat v3.3 (forced to use this version), JDK v 1.3, and Struts v1.1. I have a JSP that uses both a Form class/object and Action class/object . The JSP also does Struts validation via the validation.xml file, so the Form class extends ValidatorForm. The JSP has both a Submit and Cancel button.
I want to use a custom graphic button for both the Submit and Cancel button. The Submit button was easy. We just used this statement:
<html:image property="submit" src="images/button-submit.gif" />
The Cancel button isn't turning out to be so easy. Here is our current statement:
<html:cancel><bean:message key="button.cancel" /></html:cancel>
So I am using the html:cancel tag to disable the Struts validation check on a cancel (this works fine). Now I want to add a graphic button, BUT still be able handle the cancel and disable the Struts validation check. Ideally, I would like to keep the cancel tag and just add an image (or img) tag or attribute to add the graphic button but I can't seem to get this to work (it echos the HTML text on the JSP display). So for example I have tried:
<html:cancel><img src="images/button-cancel.gif" /></html:cancel>
and using the <html:image...> tag but these do not seem to work. Has anyone come up with a solution for this?