javavalidationjakarta-eestruts2struts2-interceptors

How does the validate() method in Struts 2 get the result "input"?


In Struts 2, "input" is returned when a check fails in the validate() method. I then map <result name="input"> in struts.xml for the appropriate page.

I am just wondering how it gets the "input", which is a String when the validate() method itself returns void?

@Override
public void validate() {
    // if checks here
}

I would like to understand this concept.


Solution

  • The validate() method itself returns nothing (void). It's invoked by validation interceptor.

    But after this interceptor usually is going workflow interceptor. This interceptor is responsible to return INPUT result if the action hasErrors().