Actually I don't think that this will work. Here is why:
The client makes an HTTP request to the servlet which then uses the
RequestDispatcher to Forward the request to the jsp page. Because he is using the
request dispatcher and not response.sendRedirect() there is no response back to the
client from the servlet. This means that the header that the jsp has access to is
the same header that the servlet had access to (only one HTTP request means only
one HTTP header). Thus request.getHeader("referer") will return the URI of the page
that referred the client to the servlet.

Why don't you want to set an attribute?

Shawn Zhu wrote:

> use request.getHeader()
>
> > -----Original Message-----
> > From: Thai Thanh Ha [mailto:[EMAIL PROTECTED]]
> > Sent: Thursday, April 26, 2001 10:52 PM
> > To: [EMAIL PROTECTED]
> > Subject: How to get URL of the original servlet after forwarding to a
> > JSP page?
> >
> >
> >  Hi all,
> >
> >  I have forwarded from a servlet to a JSP page using
> > RequestDispatcher.forward(). In the JSP page, I want to get
> > the original URL
> > (the URL of the servlet). And I don't want to use
> > request.setAttribute() in
> > the servlet. Is there any way to get the servlet's URL from
> > JSP page? I have
> > tried using request.getRequestURI() but it returns the URI of
> > JSP page.
> >
> >  Thanks in advance!
> >
> >  Thai
> >
> > ==============================================================
> > =============
> > To unsubscribe: mailto [EMAIL PROTECTED] with body:
> > "signoff JSP-INTEREST".
> > For digest: mailto [EMAIL PROTECTED] with body: "set
> > JSP-INTEREST DIGEST".
> > Some relevant FAQs on JSP/Servlets can be found at:
> >
> >  http://java.sun.com/products/jsp/faq.html
> >  http://www.esperanto.org.nz/jsp/jspfaq.html
> >  http://www.jguru.com/jguru/faq/faqpage.jsp?name=JSP
> >  http://www.jguru.com/jguru/faq/faqpage.jsp?name=Servlets
> >
>
> ===========================================================================
> To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST".
> For digest: mailto [EMAIL PROTECTED] with body: "set JSP-INTEREST DIGEST".
> Some relevant FAQs on JSP/Servlets can be found at:
>
>  http://java.sun.com/products/jsp/faq.html
>  http://www.esperanto.org.nz/jsp/jspfaq.html
>  http://www.jguru.com/jguru/faq/faqpage.jsp?name=JSP
>  http://www.jguru.com/jguru/faq/faqpage.jsp?name=Servlets

--
Erik I Morton
Software Developer
------------------
CommerceHub
http://www.commercehub.com
518-886-0704
21 Corporate Drive
Clifton Park, NY 12065

===========================================================================
To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST".
For digest: mailto [EMAIL PROTECTED] with body: "set JSP-INTEREST DIGEST".
Some relevant FAQs on JSP/Servlets can be found at:

 http://java.sun.com/products/jsp/faq.html
 http://www.esperanto.org.nz/jsp/jspfaq.html
 http://www.jguru.com/jguru/faq/faqpage.jsp?name=JSP
 http://www.jguru.com/jguru/faq/faqpage.jsp?name=Servlets

Reply via email to