-1

Below i am giving my code it shows some error it says that org.apache.struts.action does not exist what can i do for pls tell me the solution ....

import javax.servlet.http.HttpSession;
import org.apache.struts.action.Action;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionMapping;
import org.apache.struts.action.ActionForward;

public class LoginAction extends org.apache.struts.action.Action {

    /* forward name="success" path="" */
    private final static String SUCCESS = "success";


    public ActionForward execute(ActionMapping mapping, ActionForm  form,
            HttpServletRequest request, HttpServletResponse response)
            throws Exception {
             LoginBean loginbean=(LoginBean)form;
             String uname=loginbean.getLogin();
             String pass=loginbean.getPass();
             HttpSession session=request.getSession();
             ArrayList al=new ArrayList();
             al.add(uname);//User Name
             al.add("1");//User Id
             al.add("A");//User Level Means Admin Or Simple User

             if(uname.equalsIgnoreCase("Admin")&& pass.equals("admin"))
             {
                 session.setAttribute("admin",al.get(0));
                 response.sendRedirect("main.jsp");
             }
             else
             {
                 session.removeAttribute("admin");
                 response.sendRedirect("index.jsp?error=notvalid");
             }

        return mapping.findForward(SUCCESS);
    }
}

Below i am giving my code it shows some error it says that org.apache.struts.action does not exist what can i do for pls tell me the solution ....

Roman C
  • 49,761
  • 33
  • 66
  • 176
puneet
  • 23
  • 1
  • 7

1 Answers1

1

You need to add the Struts jars to the classpath.

Igor Rodriguez
  • 1,196
  • 11
  • 16
  • 1
    @puneet: You could start with the official web page: http://struts.apache.org/#Newbies – Igor Rodriguez Mar 04 '13 at 22:58
  • i did the things now it saying jakarta.apache.org/struts/tags-bean cannot be resolved in either web.xml – puneet Mar 04 '13 at 23:31
  • jakarta.apache.org/struts/tags-bean cannot be resolved in either web.xml or the jar files deployed with this application exactly this showing – puneet Mar 04 '13 at 23:37
  • @puneet: You need to create an XML mapping file for Struts. Check this tutorial: http://www.tutorialspoint.com/struts_2/struts_quick_guide.htm – Igor Rodriguez Mar 04 '13 at 23:40
  • @puneet: You do need some xml files, such as struts.xml or web.xml. It's too complex to explain it here, but the last link I published shows how to do it. – Igor Rodriguez Mar 05 '13 at 00:49