Now when I log in to my initial servlet where I have been adding my "MyName" header , it sets header fine and my jsp which uses this header uses it correct ( as the value to the button and prints "Tester") .
But when I click on the button and the control goes to SessionTestServlet ( as it is submit button) , this header is lost.
Is there a way , in which i can set up a header in a initial servlet and it can be passed in all the subsequent request to the server ? As in my case "MyName" header is passed from my jsp to the next servlet .
Any leads would be very helpful.
Joined: Sep 21, 2011
Headers are set for individual requests or responses; there is no way to keep them between requests (unless you have a special client that does so - web browser don't).
Author and all-around good cowpoke
Joined: Mar 22, 2000
Cookies are provided for the purpose of having the client browser add data to each request.
So isn't there any way in JSP ( i mean using some tags or other approach ) in which I can ask browser to send some header to servlet .
I mean as we know putting <META HTTP-EQUIV tag adds the following name to response header to be read by client . Is there any such tag which i can put so that client know that it has to send it to the servlet as header.