This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes Servlets and the fly likes Are URL parameters (GET) not resent when you do a response.sendRedirect()? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "Are URL parameters (GET) not resent when you do a response.sendRedirect()?" Watch "Are URL parameters (GET) not resent when you do a response.sendRedirect()?" New topic
Author

Are URL parameters (GET) not resent when you do a response.sendRedirect()?

Steffen Hauser
Greenhorn

Joined: Dec 04, 2007
Posts: 6
Is this right? The URL parameters (GET) are not resent to the new resource?

Example:

http://localhost:80/myapp/myservlet01?param01=helloworld calls my servlet's doGet()-method. There I do a The second call from my browser is then http://localhost:80/myapp/myservlet02, without the ?param01=helloworld parameter.

Is this right? And why is this?



William Brogden
Author and all-around good cowpoke
Rancher

Joined: Mar 22, 2000
Posts: 12761
    
    5
Of course they are not. You are redirecting to a new URL - if you want it to have parameters you have to compose the URL that way.

Redirect causes a whole new request, old request is done.

Bill
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Are URL parameters (GET) not resent when you do a response.sendRedirect()?
 
Similar Threads
passing value by hyperlink
Passing header parameters with the request
How to view image from server ???
Trying to set http://localhost to load one tomcat project?
Tomcat 404 Error - Still not working