Struts2 JPA Validation error how to forward to action and not lose ActionErrors messages ?
- by Sebastien Dionne
I'm using Hibernate validator 4.1 to validate my entity.
I have a dashboard that I can access from the action : viewDashboard. In my action, I load 2 List in my acion like this.
public String execute() throws Exception {
listDocteur = service.listDocteur();
listUser = service.listUser();
return SUCCESS;
}
In the DashBoard, I have a submit that can add a User.
<action name="saveUser" class="com.test.action.CreateUserAction" method="execute"
<interceptor-ref name="mybasicStackWithValidation"
</interceptor-ref
<result name="input"/WEB-INF/jsp/viewDashboard.jsp</result
<result name="success" type="redirectAction"viewDashboard</result
</action
if I submit invalid value, I'll see the error messages, but I'll lose my 2 Lists. If I have a type="redirectAction".. I lose the error messages.
in Struts 1, I would forward to the action viewDashboard.do without a redirect and that will works.. but How to do that in Struts2 ?