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!

Reply via email to