tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Mike W-M" <m...@ward-murphy.co.uk>
Subject Re: JSP to Servlet to JSP pathing issue. Relative Pathing Please help.
Date Mon, 16 Dec 2002 18:00:29 GMT
If you want the path in the browser's address bar to change, I think you
have to use a "redirect" rather than a "forward".  (I've read that even then
it's not guaranteed to work (since it's browser-dependent), but it's working
fine for me.  There's the disadvantage of an additional network round-trip
that's not ideal, but I don't know of any other way.)
[Actually, I guess you're already redirecting from the original jsp request
to the servlet.  If you changed that to "forward" then that'd probably solve
you're problem without the additional round-trip....]

Mike.



----- Original Message -----
From: "Jason Johnston" <Jason.Johnston@epa.state.il.us>
To: "<"Tomcat Users List"" <tomcat-user@jakarta.apache.org>
Sent: Monday, December 16, 2002 5:46 PM
Subject: JSP to Servlet to JSP pathing issue. Relative Pathing Please help.


I have a JSP that has a form that I want processed by a servlet.  The
servlet then places the results in the page context and redirects back
to the JSP.

Everything works fine on the first go, but the second time through the
path in the client's browser is no longer valid.

Initially, the path is:

http://localhost:8080/testgroup/lookup.jsp

This then sends the form data to the
/testgroup/servlet/dolookup?<parameters>

The servlet executes and uses the request dispatcher to load the
original JSP.

                RequestDispatcher
rd=getServletContext().getRequestDispatcher("//lookup.jsp");
                rd.forward(request,response);

The original JSP comes up fine and has the results, but the path in the
browser URL is still the servlet address.  Since the form sends to a
relative path, the second time you try to run, it doesn't work.


http://localhost:8080/testgroup/servlet/test.dolookup?epaid=J2466&search=id&
firstname=&lastname=

This seems to be a very simple relative pathing problem, but I've tried
various solutions with no luck.  I'm sure someone else has run into this
and found a solution.  If anyone has any insight, please help.

Thanks.



--
To unsubscribe, e-mail:   <mailto:tomcat-user-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:tomcat-user-help@jakarta.apache.org>


Mime
View raw message