You can do this in JavaScript. Add the following code to your JSP file after all your server-side processing is done:
<script language=javascript>
if (document.referrer)
{
location.replace(document.referrer);
}
</script>
-Ken
> -----Original Message-----
> From: Beheshti, Reza [mailto:[EMAIL PROTECTED]]
> Sent: Thursday, June 10, 1999 7:40 AM
> To: [EMAIL PROTECTED]
> Subject: FW: How do you send them back to where they came from?
>
>
> 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?
>
> Thanks again,
> Reza
>
>
>
> -----Original Message-----
> From: Beheshti, Reza
> Sent: Wednesday, June 09, 1999 3:04 PM
> To: 'JSP List'
> Subject: How do you send them back to where they came from?
>
>
> Hi,
> I am relatively new to JSP and Servlet, so forgive me if this
> is a trivial
> question.
> I dogged thru the servelt API and did not find anything in
> "req" object
> where I can figure out the URL of the req.
> I need to be able to (in the servelet) figure out the origin URL of a
> request, so after I process the request in the servlet, I can send it
> back/redirect it to the same exact page/URL that it came from.
>
> Thanks,
> Reza
>
> ==============================================================
> =============
> 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".
>
