UDAYAKP wrote:
> Hi,
> I'm trying to forward to different jsp pages from a servlet.
> For that I'm trying to use getRequestDispatcher() method.
> But It was not working....I mean I couldn't even compile it.
> Whats wrong in the following code.
>
It would be a lot easier to help you if you told us what the error message said --
as well as what servlet engine you are using.
>
> RequestDispatcher
> dispatcher=getServletContext.getRequestDispatcher("/jsp/Error.jsp?Var=111");
>
You need parentheses after the "getServletContext" part. It should look like
this:
dispatcher =
getServletContext().getRequestDispatcher("/jsp/Error.jsp?Var=111");
> if(dispatcher==null)
> response.sendError(response.SC_NO_CONTENT);
> else
> dispatcher.forward(request,response);
>
> Is there any way to forward to diff. jsp pages from a servlet.
> Any Solution please..
>
Another reason this might not compile is if you are using a servlet engine (such
as Apache JServ) that is based on the 2.0 servlet API, rather than the 2.1 or 2.2
APIs. In these systems, there is no such thing as a request dispatcher.
>
> Thanks in Advance
> uday.
>
Craig McClanahan
===========================================================================
To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST".
FAQs on JSP can be found at:
http://java.sun.com/products/jsp/faq.html
http://www.esperanto.org.nz/jsp/jspfaq.html