So, my scene is below.
- The page show Article by call newInfo.action with articleId parameter
- The form action will call postComment.action
- postComment.action will call validate()
- validate() return the validation error.
- * The problem is here, how can i return to tile and getting validation error?
My struts.xml
<action name="newInfo" class="org.blog.controller.NewInfo">
<result type="tiles" name="success">NewInfo</result>
</action>
<action name="postComment" class="org.blog.controller.CommentController">
<result type="redirectAction" name="success">newInfo?id=${articleId}</result
<result type="redirect" name="input">newInfo.action?id=${articleId}</result>
</action>
CommentController.java
public void validate() {
if(getName().length() == 0)
addFieldError("name", "Name is required");
if(getEmail().length() == 0)
addFieldError("email", "Email is required");
if(getCurrentURL().length() == 0)
addFieldError("website", "Website is required");
if(hasFieldErrors())
System.out.println("Field error.");
}
Current, the page result the article page, with "field error", but the page doesnt show any field error. So, is there any solutions to fix it?