Struts ActionError
Posted
by user287663
on Stack Overflow
See other posts from Stack Overflow
or by user287663
Published on 2010-04-08T05:59:00Z
Indexed on
2010/04/08
6:03 UTC
Read the original article
Hit count: 342
Hi all. Anyone knows why the code below doesn't compile? The reason is that it could not find symbol for ActionError. Thanks in advance.
package com.hbs;
import javax.servlet.RequestDispatcher; import javax.servlet.ServletException; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpSession; import javax.servlet.http.HttpServletResponse;
import org.apache.struts.action.Action; import org.apache.struts.action.ActionError; import org.apache.struts.action.ActionErrors; import org.apache.struts.action.ActionForm; import org.apache.struts.action.ActionMapping; import org.apache.struts.action.ActionForward;
import org.apache.struts.util.MessageResources;
import org.apache.commons.beanutils.PropertyUtils;
public class FeedbackAction extends org.apache.struts.action.Action {
private final static String SUCCESS = "success";
public ActionForward execute(ActionMapping mapping, ActionForm form,
HttpServletRequest request, HttpServletResponse response)
throws Exception {
ActionErrors errors = new ActionErrors();
String fullName = (String)PropertyUtils.getSimpleProperty(form, "fullName");
String fullName1 = "";
if(fullName.equals(fullName1)) {
errors.add("fullName", new ActionError("error.fullName", fullName));
saveErrors(request,errors);
return (new ActionForward(mapping.getInput()));
}
return mapping.findForward(SUCCESS);
}
}
© Stack Overflow or respective owner