Hey!
I use WebSphere but the technique should be the same.
Try this:
String url="MyJSP.jsp";
ServletContext sc = getServletContext();
RequestDispatcher rd = sc.getRequestDispatcher(url);
rd.forward(req,res);
Sans adieu,
Danny Rubis
Gokul Singh wrote:
> Hi,
>
> I am using tomcat 3.1 on windows95.
>
> I am trying to get RequestDispatcher from the
> HttpServletRequest.getRequestDispatcher(). I am having a problem.
> what I did is as follows:
>
> I tried out the following on tomcat3.1 and these are the results that I
> got Context path here was /junk
>
> available servlet mappings in my web.xml are
> /first
> /first/
> /first/abc
> /second
> /first/second
> /first/abc/second
>
> Cases tried out.
> A)
> 1) called /junk/first
> 2) Got RequestDispathcher by the method =
> response.getRequestDispatcher("second");
> -- Got a RequestDispathcer which was not null but could not forward
> to it. The message got was page not found.
>
> B)
> 1) called /junk/first/
> 2) Got RequestDispathcher by the method
> response.getRequestDispatcher("second");
> -- Got forwarded successfully to /junk/first/second
>
> C)
> 1) called /junk/first/abc
> 2) Got RequestDispathcher by the method
> response.getRequestDispatcher("second")
> -- Got forwarded successfully to /junk/first/second
>
> Why did the RequestDispatcher not work in the case 'A'. I think it
> should have forwarded to /junk/first/second or to /junk/second.
> but it did not forward to any of these. How is the RequestDispatcher
> supposed to work in this case??
>
> Can Anyone pl. explain to me why is it happening like this??
>
> Regds & Thanks,
> Gokul
>
> ___________________________________________________________________________
> To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
> of the message "signoff SERVLET-INTEREST".
>
> Archives: http://archives.java.sun.com/archives/servlet-interest.html
> Resources: http://java.sun.com/products/servlet/external-resources.html
> LISTSERV Help: http://www.lsoft.com/manuals/user/user.html
___________________________________________________________________________
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff SERVLET-INTEREST".
Archives: http://archives.java.sun.com/archives/servlet-interest.html
Resources: http://java.sun.com/products/servlet/external-resources.html
LISTSERV Help: http://www.lsoft.com/manuals/user/user.html