I have the following <s:submit>
tag code:
<s:submit action="shipment_deleteShipperFromChosenShipperViewList"
type="image" src="/llr/theme/delete.gif"
onclick="clearDirtyFlag();deleteShipperFromChosenShipperViewList('%{organizationInfo.orgId}');"
tabindex="16" />
which generates the following HTML:
<input type="image"
alt="Submit"
src="/llr/theme/delete.gif"
id="shipment_shipment_deleteShipperFromChosenShipperViewList"
name="action:shipment_deleteShipperFromChosenShipperViewList"
value="Submit"
tabindex="16"
onclick="clearDirtyFlag();deleteShipperFromChosenShipperViewList('1');"/>
The W3C Markup Validator (W3C) marks the HTML as an error. The error message is:
Attribute
value
not allowed on elementinput
at this point.
Evidently value
is not an allowed attribute when the type is image. How do I keep Struts2 from generating the value
attribute?
Until the fixed version is released, you have a few options.
Use plain HTML input tag <input type="image" ...>
instead of <s:submit>
. If you are using not simple
theme then you also should put <input>
into some HTML tags.
Copy the submit.ftl
from the struts2-core jar into your project and modify it.
Just ignore this W3C Markup Validator error, there are probably worse things to worry about. :)