Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / First Aid / June 2005

Tip: Looking for answers? Try searching our database.

request dispatcher problem

Thread view: 
sarath - 07 Jun 2005 08:03 GMT
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 - 07 Jun 2005 15:02 GMT
> 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");

Signature

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

Chris Smith - Lead Software Developer/Technical Trainer
MindIQ Corporation

sarath - 08 Jun 2005 06:56 GMT
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 - 08 Jun 2005 11:00 GMT
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

> > i am  using Tomcat 5.5.9. My jsp pages are stored in,
> >
[quoted text clipped - 17 lines]
> Chris Smith - Lead Software Developer/Technical Trainer
> MindIQ Corporation


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.