i want to set http headers for a request and process the this header values and set the http response header.
i could find setHeader method for the response object but not for request
public void doPost (HttpServletRequest req, HttpServletResponse resp)throws ServletException, IOException
{
String value=req.getHeader("MyName");
resp.setHeader("YourName", "Devi");
resp.setContentType("text/html");
PrintWriter out=resp.getWriter();
out.println("Header Value = " + value);
}
what i'm planning to do is...pls correct me if i'm wrong.
i have a jsp page this will set the http request header named "MyName".
Now when i submit this page this will call the servlet shown above.
this servlet will retrive this header value and set the response header and
writes back to the client.
from the client i want to take the response header value.
hope u understood what i mean though the way i did doesnot make sense.
i'm new to web applications and j2ee.
example codes will be really appreciated