hai guys,
i am trying to execute the RequestDispatcher problem but it is giving me an error 404 "the page /project/admin.jsp" can't found.but its there in the dir.
here it goes.in my dir of webapps (
tomcat 5.0) /project/ there are admin.jsp,dataentry.jsp,manager.jsp etc.
when i press the submit button of login.html page it will call
Servlet for which the code is shown below:
public void doGet(HttpServletRequest request,HttpServletResponse response)
throws ServletException, IOException {
String accounttype = request.getParameter("type");
String usr = request.getParameter("user");
String pwd = request.getParameter("password");
if(type.equals("Admin"))
gotoPage("/project/admin.jsp",request, response);
// project/admin.jsp project is the dir in my webapps folder of tomcat 5.0
// and admin.jsp is the page which is having req.getparameter();
else if(type.equals("Dept_User"))
gotoPage("/project/deptuser.jsp",request, response);
else if(type.equals("DataEntry"))
gotoPage("/project/dataentry.jsp",request, response);
else if(type.equals("Manager"))
gotoPage("/project/manager.jsp",request, response); }
private void gotoPage(String address,HttpServletRequest request,HttpServletResponse response) throws ServletException, IOException {
RequestDispatcher dispatcher =getServletContext().getRequestDispatcher(address);
dispatcher.forward(request, response); } }//end of class
i also tried with res.sendRedirect(url), it is working.
plz tell me why i am getting this error . also the steps for using RequestDispatcher. plz mail me to
itsmaheshp@yahoo.com is u have code for that.
thanks
alot regards,
Mahesh