I have a Jsp with some textfields, these are validate using Hibernate
validation annotation (@Valid or @NotNull in the action) except one (input
image file) that is validate with default Struts2 validation (using
ActionName-validation.xml). I want to redirect to another action when the
submitted form is invalid (when textfields are null), and I want to store
fields error.
I tried with this:
<interceptors>
<interceptor name="SessionCheckInterceptor"
class="util.SessionCheckInterceptor"/>
<interceptor-stack name="mySessionValidationStack">
<interceptor-ref name="defaultStackHibernate" />
<interceptor-ref name="SessionCheckInterceptor" />
</interceptor-stack>
</interceptors>
<default-interceptor-ref name="mySessionValidationStack"/>
<action name="insert" class="actions.InsertAction" >
<interceptor-ref name="mySessionValidationStack">
image/png
</interceptor-ref>
<interceptor-ref name="store">
STORE
</interceptor-ref>
<interceptor-ref name="defaultStack" />
<result name="success" type="tiles" >baseLayout</result>
<result name="error" type="redirectAction" >
showinsertform
</result>
<result name="input" type="redirectAction" >
showinsertform
</result>
</action>
<action name="showinsertform" class="actions.ShowInsertFormAction" >
<interceptor-ref name="mySessionValidationStack" />
<interceptor-ref name="store">
RETRIEVE
</interceptor-ref>
<result name="success" type="tiles" >insert</result>
<result name="error" type="tiles" >baseLayout</result>
</action>
But when I sumbit the form, the redirect succeed without showing me fields
error messages. Maybe I'm setting wrong the interceptor? Using hibernate I
need to override something? If I try to set manually error messages in the
action (with addActionError), they works! Can it be that hibernate error
fields messages are not stored in the session?
--
View this message in context:
http://struts.1045723.n5.nabble.com/Store-Interceptor-not-working-with-field-error-using-Hibernate-validation-tp5711481.html
Sent from the Struts - User mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]