Thanks a lot to both David Smith and Yue Mu - I am exploring other options of setting values.
Also someone else has suggested that I use POST from a form - i willl try that too - thanks a ton, Anoop Kumar V. On 2/5/06, David Smith <[EMAIL PROTECTED]> wrote: > > Anoop -- > > Correct me if I'm wrong, but it looks like you are trying to set > response headers on a 302 response and then expecting those headers to > return on the next request. I can't find any information indicating > this behavior is supported by the HTTP protocol. You are better off > setting cookies, GET parameters, or session attributes to transfer info > the the next request. The first two will work for any request to the > same server. The last one will only work if the next request is going > to the same webapp. > > --David > > Yue Mu wrote: > > HI Anoop, > > > > >> Is it that the response of the first page becomes the request of > the next jsp.... > > > > No - "the next jsp" gets the same request, which is the whole idea of > "forwarding" a request. This is why you don't see the newly added headers > (to the response!). > > > > I'm not sure what you are trying to do but you need to use > Response.containHeaders(java.lang.String name) to check if a header is > already there. > > > > Hope this helps. > > > > Regards, > > Z. > > > > Anoop kumar V <[EMAIL PROTECTED]> wrote: > > I would really appreciate if someone can answer my question.. > > > > Thanks, > > Anoop > > > > On 2/3/06, Anoop kumar V wrote: > > > >> HI All, > >> > >> I am using Tomcat5. > >> I have a simple jsp displaying the header information that I have set > in > >> another jsp page. For some reason I can see all the default headers > except > >> the headers that I have set in this jsp. I am doing a jsp:forward to go > to > >> the next page which displays the header information ( I have also tried > >> redirect - but just wont work)... > >> > >> > >> > ------------------------------------------------------------------------------------------------------------ > >> ------------------------------------------ > >> index.jsp---------------------------------------------------- > >> > >> > ------------------------------------------------------------------------------------------------------------ > >> > >> > >> > >>> @author Anoop Kumar V. > >>> > >> Date: Jan 19, 2006 4:13:05 PM > >> --%> > >> > >> > >> > >> > >> > >> > >> > >> > > > > > >>> System.out.println("Jsp called successfully"); > >>> > >> response.addHeader("userName","GSE_FMS"); > >> response.setHeader("userName","GSE_FMS"); //just to be sure..... > >> response.addHeader("myValue","theValue"); > >> > >> boolean isheader = response.containsHeader("userName"); > >> > >> System.out.println("\n!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\ncontains > >> userName header ..."+isheader); > >> System.out.println("contains myValue header ..." + > >> response.containsHeader("myValue")); > >> //response.sendRedirect("/TestHeaderResponse.jsp"); > >> > >> %> > >> > >> > >> > >> > >> > ------------------------------------------------------------------------------------------------------------ > >> -------------------------- > >> TestHeaderResponse.jsp---------------------------------------------- > >> > >> > ------------------------------------------------------------------------------------------------------------ > >> > >> > >>> Created for Sikorsky GSE > >>> > >> @author Anoop Kumar V. > >> Date: Jan 19, 2006 4:13:05 PM > >> --%> > >> > >> > >> > >> > >> > >> > >> > > > > > >>> System.out.println("Test header response page called > successfully"); > >>> > >> String s = request.getHeader("userName"); > >> System.out.println("user: "+s); // Issue: always > returns > >> null even though set in the previous page > >> out.println("USERNAME HEADER: " + s +" > >> > > "); > > > >> Enumeration headernames = request.getHeaderNames(); > >> System.out.println("Headers---------"); > >> while (headernames.hasMoreElements()){ > >> String headername = (String)headernames.nextElement(); > >> String headervalue = request.getHeader(headername); > >> System.out.println(headername+"----"+headervalue); > >> out.println(" " + headername+"----"+headervalue + " > >> > > "); > > > >> out.flush(); > >> } > >> %> > >> > >> > >> > >> > ------------------------------------------------------------------------------------------------------------ > >> > >> I think I am doing something fundamentally wrong.... > >> > >> Also can someone help me with understanding how the setHeader and > >> getHeader works - we use response.setHeader to set but use > >> request.getHeader to read the header values. Is it that the response of > >> the first page becomes the request of the next jsp.... > >> -- > >> Thanks and best regards, > >> Anoop > >> > >> > >> > > > > > > -- > > Thanks and best regards, > > Anoop > > > > > > > > --------------------------------- > > Relax. Yahoo! Mail virus scanning helps detect nasty viruses! > > > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > > -- Thanks and best regards, Anoop