Skip to Main Content

Java EE (Java Enterprise Edition) General Discussion

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

The import org.apache.struts.action.ActionError cannot be resolved

843840Nov 17 2007
Hai anyone,. I' a newbie to struts and want to learn more. I download the example code, and run it. Hey, it work. But when I try to create it by myself by following the tutorial, I got stuck with my all java file when i want to try to compile it with eclipse.It say:

The import org.apache.struts.action.ActionError cannot be resolved

What' wrong?

this is one of the example code, i bolded the error line:

package dummies.struts.music;

import javax.servlet.http.HttpServletRequest;
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.ActionForward;
import org.apache.struts.action.ActionMapping;
import org.apache.struts.validator.DynaValidatorForm;

/**
* @author Mike Robinson
*
*/
public class LoginAction extends Action
{
/**
* Handles request from user
* @param mapping
* @param form
* @param request
* @param response
* @throws Exception
*/
public ActionForward execute( ActionMapping mapping,
ActionForm form,
HttpServletRequest request,
HttpServletResponse response)
throws Exception
{
// did the user click the Join button?
Boolean bCancel = (Boolean)request.getAttribute("org.apache.struts.action.CANCEL");
if(bCancel != null)
if(bCancel.booleanValue())
return (mapping.findForward("join"));

// create a new LoginBean passing the datasource
LoginBean lb = new LoginBean(getDataSource(request, "musiccollection"));

// check to see if this user/password combination are valid
// will return a non-null UserDTO if valid
UserDTO user = lb.validateUser((String)((DynaValidatorForm)form).get("email"),
(String)((DynaValidatorForm)form).get("password"));
if(user != null)
{
// save UserDTO in session
request.getSession().setAttribute("user",user);
return (mapping.findForward("success"));
}
else // username/password not validated
{
// create ActionError and save in the request
ActionErrors errors = new ActionErrors();
ActionError error = new ActionError("error.login.invalid");
errors.add("login",error);
saveErrors(request,errors);

return (mapping.findForward("failure"));
}
}
}
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Dec 15 2007
Added on Nov 17 2007
0 comments
917 views