wood burning stoves 2.0*
The moose likes Servlets and the fly likes Servlet Header Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Servlets
Bookmark "Servlet Header" Watch "Servlet Header" New topic
Author

Servlet Header

Jayaraj Jaganathan
Ranch Hand

Joined: Jun 29, 2009
Posts: 70


after 10 sec it redirect to C.jsp
but in C.jsp i get only null, please let me me why i get null ?

Paul Clapham
Bartender

Joined: Oct 14, 2005
Posts: 18541
    
    8

Question is about servlets, not Websphere. Moving.
shivendra tripathi
Ranch Hand

Joined: Aug 26, 2008
Posts: 263
In case of redirect new request will come to JSP so will lose anything you set in previous request. You can use request dispatcher to achive your goal.


SCJP 1.5(97%) My Blog
Balu Sadhasivam
Ranch Hand

Joined: Jan 01, 2009
Posts: 874

shivendra tripathi wrote:In case of redirect new request will come to JSP so will lose anything you set in previous request. You can use request dispatcher to achive your goal.



No you can't. anything set in Header is used by the Client browsers and is not to store values in the application. Its common misleading statement. The values set in response headers are no way available in subsequent request. This is not the way it works.
shivendra tripathi
Ranch Hand

Joined: Aug 26, 2008
Posts: 263
I have never written anything about assessing response header by a resource in application. I am taking about passing request to other resource using RequestDispatcher and I dont see any issue with that.
Balu Sadhasivam
Ranch Hand

Joined: Jan 01, 2009
Posts: 874


OP question is on request & response "headers" and not in request dispatchers.
shivendra tripathi
Ranch Hand

Joined: Aug 26, 2008
Posts: 263

OP question is on request & response "headers" and not in request dispatchers.

Can you elaborate your comments. I didnt get that.
Jayaraj Jaganathan
Ranch Hand

Joined: Jun 29, 2009
Posts: 70

No you can't. anything set in Header is used by the Client browsers and is not to store values in the application. Its common misleading statement. The values set in response headers are no way available in subsequent request. This is not the way it works.


you mean that name can be only which is in the below list

Cache-Control
Pragma
Connection
Retry-After
Expires
Location
WWW-Authenticate
Content-Encoding
Location
Refresh

if i missed out . please let me me know when can i find the full list ?
i get these information from http header

Balu Sadhasivam
Ranch Hand

Joined: Jan 01, 2009
Posts: 874



you mean that name can be only which is in the below list


not necessarily , the headers that you have added might be used by Client Browsers if it can interpret it. But certainly not sent in the subsequent response.


if i missed out . please let me me know when can i find the full list ?


request getHeaderNames() should provide most of them.
 
wood burning stoves
 
subject: Servlet Header
 
Similar Threads
HttpClient just wont download a audio file
Connection Pooling
Servlet Redirection
java.sql.SQLException: Parameter index out of range (5 > number of parameters, which is 4).
response.sendRedirect no executing