tags:

views:

198

answers:

2

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);
}

}

A: 

Did you check your build path for struts jar file?

CoolBeans
A: 

ActionError is deprecated since struts 1.2. Please check which version of struts you are using. You can use ActionMessage instead of ActionErrors class.

PKS

Shivaprasad