I'm working on struts 1.1 application.
I have added validation for JSP form page(i.e. adduser.jsp).
It get validated after clicking on add button. And my validation in "Validator-XSS.xml" working fine.
But when validation fails then it forward to input attribute which is jsp form page(i.e. adduser.jsp).
Here I need to forward callto another action
(i. e.openAddUser.do)
which open JSP form page(i.e. adduser.jsp) insted of JSP page.
UPDATE
struts-config.xml
<struts-config>
<!-- some another entries -->
<form-bean name="UserForm" type="com.UserForm"/>
<action path="/createuser" type="com.CreateUserAction" name="UserForm"
scope="request">
<forward name="adduser" path="/jsp/adduser.jsp"/>
</action>
<action path="/adduser" type="com.AddUserAction" input="/jsp/adduser.jsp"
name="UserForm" scope="request">
<forward name="showuser" path="/showUserDetails.do"/>
</action>
<plug-in className="org.apache.struts.validator.ValidatorPlugIn">
<set-property
property="pathnames"
value="/WEB-INF/User-Validator.xml"/>
</plug-in>
</struts-config>
XSS-validator.xml
<form-validation>
<formset>
<form name="UserForm">
<field property="userName" depends="mask">
<msg name="mask" key="ui.field.invalidvalue" bundle="appResources"/>
<var>
<var-name>mask</var-name>
<var-value>^[a-zA-Z0-9-_]*$</var-value>
</var>
</field>
</form>
</formset>
on clicking on create user in jsp file it will call createuser.do It will open adduser.jsp after entering details in form and click on add button it will adduser.do also it get vlidated through XSS-validator.xml but call goes to jsp/adduser.jsp but i need it has to call createuser.do
ActionForm is extended by ValidatorForm
public class UserForm extends ValidatorForm{
String userName;
String userId;
//getter setter
}
ActionClass
Public Class CreateUserAction{
public ActionForward execute(ActionMapping mapping,ActionForm form,HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException {
//some code to bring list and other details
mapping.findForward("adduser");
}
Public Class AddUserAction{
public ActionForward execute(ActionMapping mapping,ActionForm form,HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException {
//some code to add user and other details
mapping.findForward("showuser");
}