File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Set and Get the values from the Http Header

 
Ravindranath Chowdary
Ranch Hand
Posts: 71
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Rancher
Pie
Posts: 42966
73
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
marc weber
Sheriff
Posts: 11343
Java Mac Safari
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
This has nothing to do with the SCJP exam.
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic