Home Jsp getHeader() Method Of The Request Object

Related Tutorials


 
 

Share on Google+Share on Google+

getHeader() Method Of The Request Object

Advertisement
This section gives you the best illustration about the getHeader() method of the request object.

getHeader() Method Of The Request Object

     

This section gives you the best illustration about the getHeader() method of the request object. Here, you will learn more about the getHeader() method like why is it used and how is it implemented. Through the help of the section you will get the complete information about the HTTP header.

This method returns the value of the HTTP header like query string or the URL. This method takes a string parameter which is the header name retrieved by the method getHeaderNames() of the request object that gives all the HTTP header names in the enumeration form which has to be converted into string form later for getting the value of the value of the HTTP header from if one by one.

Here is the code of the GetHeaderMethod.jsp file:

<%@page import="java.util.*" %>
<%
	String headername = "";
	for(Enumeration e = request.getHeaderNames();
 e.hasMoreElements();){
		headername = (String)e.nextElement();
		out.println(request.getHeader
(headername) + "<br/>");
	}
%>

Output for the above mentioned file:

Download GetHeaderMethod.jsp file.

Advertisement

If you enjoyed this post then why not add us on Google+? Add us to your Circles



Liked it!  Share this Tutorial


Follow us on Twitter, or add us on Facebook or Google Plus to keep you updated with the recent trends of Java and other open source platforms.

Posted on: February 9, 2008

Related Tutorials

Discuss: getHeader() Method Of The Request Object   View All Comments

Post your Comment


Your Name (*) :
Your Email :
Subject (*):
Your Comment (*):
  Reload Image
 
 
Comments:0
DMCA.com