Ok banging my head against a brick wall here for the last 2 days as my validation message will not output on the JSP although validation is clearly happening...
I have set up simple validation for a required field through an action-validation.xml
<validators>
<field name="firstname">
<field-validator type="requiredstring">
<message>First name is required</message>
</field-validator>
</field>
</validators>
Action class extends ActionSupport and interfaces ServletRequestAware, Preparable, ModelDriven
Execute, prepare and validate methods have all be overridden within the action class and its configuration is
<package name="main" namespace="/" extends="struts-default">
<action name="myform" class="com.uk.MyFormAction">
<interceptor-ref name="store">
<param name="operationMode">STORE</param>
</interceptor-ref>
<interceptor-ref name="defaultStack" />
<result name="update">s2/user.jsp</result>
<result name="input">s2/user.jsp</result>
</action>
</package>
For whatever reason the validation from the validation.xml file will not output anything within my JSP within
<s:if test="hasActionErrors()">
<s:actionerror />
</s:if>
<s:textfield name="firstname" />
There are other fields on the page, I'm just trying to get this one to work first. I've added the interceptor store which makes no difference and faffed with the type="redirectAction" however when that is added to my input result I get an infinite loop between my validation and prepare methods for the action upon submission...
the actual configuration I'm sure is correct. When the field is present the submission goes through correctly however when it is blank struts does redirect back to the JSP but gives no error messages.
I am now totally out of ideas on what could be wrong, any suggestions please ?
Edit: Incidentally if I add a addActionError() viamy validate function it displays correctly on the page, but again the validation.xml message is missing (and should not be)
Also struts.ui.theme=simple
is being used
Nearest post I can find that relates to my problem can be found here however the interceptor for messages doesn't seem to store or intercept my messages... I have tried to output the number of ActionErrors by printing the size of getActionErrors collection which returns 0 in my execute and validation functions... I'm not sure if that should return the validation.xml errors if working correctly