"Beheshti, Reza" wrote:
>
> Thanks to all of you who responded, but I still can not get to the original
> page URL!!!
> I tried both HttpUtils.getRequestURL() and req.getRequestURI() from the
> servlet and BOTH of them just return the URL for the servlet NOT the page
> that the servlet was called from.
>
> Here is an example of what I need to do:
>
> If I call my servlet (Say www.xxx.com/servlet/MyServlet
> <http://www.xxx.com/servlet/MyServlet> ) from www.xxx.com/page1.jsp
> <http://www.xxx.com/page1.jsp>  I need to be able to return to
> www.xxx.com/page1.jsp <http://www.xxx.com/page1.jsp>  after I am done my
> processing in the servlet. Since several different URLs can call the same
> process in servlet, I need to be able to return to the originating page.
> All the methods that I have tried so far, including the above mentioned
> ones, ALWAYS return the URL for the servlet (i.e.
> www.xxx.com/servlet/MyServlet <http://www.xxx.com/servlet/MyServlet> )
> instead of the originating .jsp page that I really need.
>
> I though about passing a parameter to the Servelt as to where to return to,
> but I was hoping that there is a way to find out where the originating
> .jsp's URL is in the servlet that receives the request.
>
> Any other thoughts?

You're not telling us the whole story yet, so that's why you don't get the
right answer. How do you call the servlet from the JSP? Which JSP implementation
do you use? That's the important information.

If you're using a JSP 1.0 implementation and <jsp:include>, the request
attribute "javax.servlet.include.request_uri" contains what your looking for
(see JSP 1.0 Appendix B).

But I believe the current reference implementation doesn't yet support
dynamic content (such as a servlet) through <jsp:include>. Instead it
implements the "public draft 1" specification, where
<jsp:request include=file> performs the same function.

The "javax.servlet.include.request_uri" is also set if you use a scriptlet
to get a RequestDispatcher for the servlet and then using the RD.include
method to call it.

Did I get it right this time?
--
Hans Bergsten           [EMAIL PROTECTED]
Gefion Software         http://www.gefionsoftware.com

===========================================================================
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff JSP-INTEREST".  For general help, send email to
[EMAIL PROTECTED] and include in the body of the message "help".

Reply via email to