Well, yes and no. It depends.

If you use "forward", then the URL displayed in the browser's address bar will 
be the URL of the servlet originally requested, because the browser doesn't 
know that you forwarded to a JSP. Whereas if you use "redirect", you actually 
ask the browser to request the JSP itself, and therefore it changes the address 
bar to display the URL of the JSP.

The side effect of "redirect" is that the user can bookmark your JSP, and 
subsequently (maybe in a different session next week) go directly to the JSP 
without running your servlet first. I didn't follow the bit about inducing 
anchors, but if the servlet is required for initialization of the JSP then you 
don't want people to bookmark the JSP and jump directly to it. That might mean 
you use "forward" but make the servlet more intelligent, so that it doesn't 
redo long-running initializations. Depends on your design.

Regards
PC2

-----Original Message-----
From: java400-l-bounces@xxxxxxxxxxxx [mailto:java400-l-bounces@xxxxxxxxxxxx] On 
Behalf Of RPower@xxxxxxxxxx
Sent: August 30, 2005 07:52
To: Java Programming on and around the iSeries / AS400
Subject: Re: JSP?

Could it be the forward?  Should I be using a redirect instead?

Ron Power
Programmer
Information Services
City Of St. John's, NL
P.O. Box 908
St. John's, NL
A1C 5M2
709-576-8132
rpower@xxxxxxxxxx
http://www.stjohns.ca/
___________________________________________________________________________
Success is going from failure to failure without a loss of enthusiasm. - Sir 
Winston Churchill




RPower@xxxxxxxxxx 
Sent by: java400-l-bounces@xxxxxxxxxxxx
2005/08/30 12:05 PM
Please respond to
Java Programming on and around the iSeries / AS400 
<java400-l@xxxxxxxxxxxx>


To
"Java Programming on and around the iSeries / AS400" 
<java400-l@xxxxxxxxxxxx>
cc

Subject
JSP?






Why is it that when I refresh what I think is supposed to be a page, my 
servlet gets refreshed too that loaded the page?  ie:
LoadStreets does this:
                        getServletConfig()
                                .getServletContext()
                                .getRequestDispatcher("schedule_left.jsp")
                                .forward(req, resp);
yet if I click on the properties for schedule_left.jsp or view source it's 


        http://cpu913.secure.city.st-johns.nf.ca:9080/bulk/LoadStreet
when I think it should be:
 http://cpu913.secure.city.st-johns.nf.ca:9080/bulk/schedule_left.jsp.
If I click on a select box that I have for quicklinks, it refreshes the 
page as:
 http://cpu913.secure.city.st-johns.nf.ca:9080/bulk/schedule_left.jsp#C
Is there something I'm doing wrong to have the browser thinking I'm in 
LoadStreet when I'm actually in schedule_left.jsp?  It's become a 
performance issue for me cause I have anchors on the page that when the 
anchors are first induced, the page reloads, but once the properties of 
the page are the page, it's fine.  Please help and thanks.


As an Amazon Associate we earn from qualifying purchases.

This thread ...

Follow-Ups:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.