The Artima Developer Community
Sponsored Link

Java Answers Forum
Server Side Forward Object

3 replies on 1 page. Most recent reply: Aug 1, 2002 9:53 PM by Jay Kandy

Welcome Guest
  Sign In

Go back to the topic listing  Back to Topic List Click to reply to this topic  Reply to this Topic Click to search messages in this forum  Search Forum Click for a threaded view of the topic  Threaded View   
Previous Topic   Next Topic
Flat View: This topic has 3 replies on 1 page
Russell Spieler

Posts: 1
Nickname: russ
Registered: Jul, 2002

Server Side Forward Object Posted: Jul 31, 2002 11:52 AM
Reply to this message Reply
Advertisement
I have a JSP page that "POSTs" its form information to a JSP process page. The process page uses the JSP forward method to transfer its information to another JSP page. The pages work and load fine, but.... if I look at the properties of the third page, the URL is listed as the URL of the Process page. I need to get the URL of the third page using JSP. How can I use JSP to set the URL Loctation object to the third page?
I read that the location method is much like the include method so I assume I am actually displaying the process page with the third page included.....


Jay Kandy

Posts: 77
Nickname: jay
Registered: Mar, 2002

Re: Server Side Forward Object Posted: Jul 31, 2002 6:17 PM
Reply to this message Reply
RequestDispatcher.forward() passes the old request and response to the new servlet. So the new forwarded thingy has still the same session, same most everything. On the other hand, response.sendRedirect() creates a new request and response objects. Literally redirects the page.

Don Hill

Posts: 70
Nickname: ssswdon
Registered: Jul, 2002

Re: Server Side Forward Object Posted: Aug 1, 2002 8:22 AM
Reply to this message Reply
These are both serverside redirects, as far as the client is concerned they are still the same url, I Think. If you do a cleint side redirect you will get the url location in the browser, this can be done with the jsp by using the document.location ? .

HTH

Jay Kandy

Posts: 77
Nickname: jay
Registered: Mar, 2002

Re: Server Side Forward Object Posted: Aug 1, 2002 9:53 PM
Reply to this message Reply

> These are both serverside redirects, as far as the
> client is concerned they are still the same url, I
> Think. If you do a cleint side redirect you will get

Thats not true. Like I said, a RequestDispatcher uses the same request and response objects - including the query string parameters to the next page. This means, the client doesnt get any information from the server. No headers are set. So the client doesnt have any idea about the redirect.

On the other hand, a response.sendRedirect() sets new request and response object. This is the line in the specs: (under title 6.3 Convenience Methods )

The sendRedirect method will set the appropriate headers and content body to redirect the
client to a different URL.

A 302 header is set, the resulting page has its own URL.

> the url location in the browser, this can be done
> with the jsp by using the document.location ? .

To me, that sounds more like JavaScript not JSP.

>
> HTH

-Jay

Flat View: This topic has 3 replies on 1 page
Topic: GUI component dumping... Previous Topic   Next Topic Topic: Swing v/s HTML

Sponsored Links



Google
  Web Artima.com   

Copyright © 1996-2019 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use