2
<form-bean name="RegisterForm" type="com.mysite.form.RegisterForm" />

<action path="/register" type="com.mysite.action.RegisterAction" name="RegisterForm" input="/register.jsp" validate="true">
                <forward name="success" path="/welcome.jsp" />
                <forward name="failure" path="/register.jsp" />
            </action>

RegisterForm

public class RegisterForm extends ActionForm{
private String name;

    /**
    Constructor
    Set+Get
    **/

    public ActionErrors validate(ActionMapping mapping, ServletRequest request) {

        ActionErrors errorList = new ActionErrors();
        System.out.println("VALIDATING");
        return errorList;
    }
}

This is all i have. For some reason it seems that the control flow jumps directly to the ActionForm's execute method because I can't even see the VALIDATING message in the console. Is there something I'm missing? Thanks!

TGM
  • 1,659
  • 10
  • 30
  • 45
  • Try to validate your action form with ValidatorForm instead of ActionForm and let me know the result. – Naved Nov 27 '11 at 14:22
  • The given code is not real code, because it doesn't compile (Public instead of public). Try adding the @Override annotation to the validate method, to make sure you're actually overriding the ActionForm's validate method. Also try to include an error in the ActionErrors: you might miss the VALIDATING message in the console. – JB Nizet Nov 27 '11 at 17:30
  • @JBNizet it is real code but I edited it because there were a lot of validation and it didn't make any point to put those here. The methos is overriding the parent method. – TGM Nov 27 '11 at 18:49
  • @Naved it seems to work just fine with the ValidatorForm – TGM Nov 27 '11 at 18:50

1 Answers1

1

You need to use the other overloaded validate() method that takes HttpServletRequest

Baski
  • 829
  • 8
  • 14