aspose file tools*
The moose likes JSP and the fly likes Set and Get the values from the Http Header Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Java » JSP
Bookmark "Set and Get the values from the Http Header" Watch "Set and Get the values from the Http Header" New topic
Author

Set and Get the values from the Http Header

Ravindranath Chowdary
Ranch Hand

Joined: Nov 08, 2006
Posts: 71
Hi
I have a requirement to set the values to the http header in one jsp file and get the values from the http header in the other jsp file.
I tried to set the values to the response by using the both ways mentioned as below...
<%
response.setHeader("name", value);
response.addHeader("name", value);

response.sendRedirect("../second.jsp");
%>

i have the following logic to retrieve from the http header...

<%
StringBuffer sb = new StringBuffer();
Enumeration headerNames = request.getHeaderNames();
%>

Here I could not able to get the values set to the http header.

Can any one give an idea how to set and get the values from the http header.

Thanks,
Ravindra.
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 39529
    
  27
This is fundamentally impossible. Response headers are about the response sent back to the client; they have nothing to do with the next request, and won't be included in it.

But since you are using a redirect, you can pass a value in the URL, like


Ping & DNS - updated with new look and Ping home screen widget
marc weber
Sheriff

Joined: Aug 31, 2004
Posts: 11343

This has nothing to do with the SCJP exam.


"We're kind of on the level of crossword puzzle writers... And no one ever goes to them and gives them an award." ~Joe Strummer
sscce.org
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Set and Get the values from the Http Header
 
Similar Threads
Could not get the connection in struts database application
template:insert problem/issue....
Problem while Tag lib Up gradation
setting request header
SessionAffinityManager setCookie SESN0066E: The response is already committed to the client.