I'm following the Struts 2 Hello World Annotation Example tutorial by Mkyong:
@Namespace("/User")
@ResultPath(value="/")
@Action(value="/welcome",
results={@Result(name="success", location="pages/welcome_user.jsp")})
public class WelcomeUserAction extends ActionSupport {
public String execute(){
return SUCCESS;
}
}
Accessing the URL http://localhost:8080/project_name/User/welcome
works fine.
Now I'm trying to move the @Action (and hence @Result) annotation from class level to method level:
@Namespace("/User")
@ResultPath(value="/")
public class WelcomeUserAction extends ActionSupport {
@Action(value="/welcome",
results={@Result(name="success", location="pages/welcome_user.jsp")})
public String execute(){
return SUCCESS;
}
}
But after doing this, I get the 404 error:
/project_name/pages/welcome_user.jsp
is not found.
My JSPs are under
/WebContent/User/pages
Why is this happening ?