• Post Reply Bookmark Topic Watch Topic
  • New Topic

How to create custom http request and response headers

 
Simon Sew
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all...

I'm trying to create a few custom headers (via response.setHeader() or response.addHeader() ).
after that I will use <jsp:forward> to forward the request..to another page which i wanted to retrieve the header value.

All I get is just null value.

How can I set and retrieve custom headers value??
I'm out of ideas...


Thanks
 
Max Rahder
Ranch Hand
Posts: 177
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The header is part of the stream of information you send to the client. The header comes first, followed by the body. That means that as soon as you start writing the body of the response, you've moved past the header in the output steam, and subsequent statements that write to the header will -- well, I'm not sure what will happen, but it's not the right thing to do! Normally, if you need to pass information between pages you'd set an attribute on the request.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!