For Programmers: Free Programming Magazines  


Home > Archive > Java Help > June 2005 > request dispatcher problem









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author request dispatcher problem
sarath

2005-06-07, 4:03 pm

Hi ..

I am trying to pass control from a servlet to a jsp, using request
dispatcher using the code,

RequestDispatcher rd = null;
rd = request.getRequestDispatcher("/admin-gui/PolicyMenu.jsp");

rd.forward(request,response);
but when i run the code, i get an error like,


message /servlet/admin-gui/PolicyMenu.jsp

description The requested resource (/servlet/admin-gui/PolicyMenu.jsp)
is not available.



i am using Tomcat 5.5.9. My jsp pages are stored in,

c:\Tomcat 5.5\webapps\admin-gui

and the servlet class is stored in,

c:\Tomcat 5.5\webapps\admin-gui\WEB-INF\classes



please help me soon...

regards

sara

Chris Smith

2005-06-07, 4:03 pm

sarath <mesarath@gmail.com> wrote:
> i am using Tomcat 5.5.9. My jsp pages are stored in,
>
> c:\Tomcat 5.5\webapps\admin-gui


> RequestDispatcher rd = null;
> rd = request.getRequestDispatcher("/admin-gui/PolicyMenu.jsp");


The first problem I see is this. The parameter to getRequestDispatcher
is a context-relative URI. You don't seem to be passing a context-
relative URI. Since "admin-gui" is part of the context path, it should
be omitted, like this:

RequestDispatcher rd = null;
rd = request.getRequestDispatcher("/PolicyMenu.jsp");

--
www.designacourse.com
The Easiest Way To Train Anyone... Anywhere.

Chris Smith - Lead Software Developer/Technical Trainer
MindIQ Corporation
sarath

2005-06-08, 4:01 am

thanks for your advice..i followed your advice and it worked and
reached that jsp page, but when i click some links from there, it is
not going to any page and gives me errors....
the page flow was like,

submit Link submit
login.jsp------>PolicyMenu.jsp----> other.jsp--->servlet the back
to PolicyMenu.jsp through request despatcher..and when i am trying to
go to the other.jsp, i get the error that,

The requested resource (/servlet/other.jsp) is not available. while it
was working perfectly earlier when i came through the login page...

my workspace is like,

/webapp/admin-gui/ -->contains jsp files (PolicyMenu.jsp and
other.jsp)
/webapps/admin-gui/WEB-INF/classes --> contains the servlet from which
i am get request from other.jsp and i am trying to dispatch to
PolicyMenu.jsp.


please help ...if you require any more details, ask me....

its been almost 2 days i am stuck with this...

regards

sarath

sarath

2005-06-08, 8:59 am

i also have a doubt whether i should set some value in the web.xml or
some other xml file so that the application context is the place where
i have put my jsp files

Chris Smith wrote:
> sarath <mesarath@gmail.com> wrote:
>
>
> The first problem I see is this. The parameter to getRequestDispatcher
> is a context-relative URI. You don't seem to be passing a context-
> relative URI. Since "admin-gui" is part of the context path, it should
> be omitted, like this:
>
> RequestDispatcher rd = null;
> rd = request.getRequestDispatcher("/PolicyMenu.jsp");
>
> --
> www.designacourse.com
> The Easiest Way To Train Anyone... Anywhere.
>
> Chris Smith - Lead Software Developer/Technical Trainer
> MindIQ Corporation


Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com