Home Jsp getHeaderNames() Method Of The Request Object

Related Tutorials


 
 

Share on Google+Share on Google+

getHeaderNames() Method Of The Request Object

Advertisement
In this section, you will learn how to get the header name of the host server.

getHeaderNames() Method Of The Request Object

     

In this section, you will learn how to get the header name of the host server. This section gives you the brief introduction about the getHeaderNames() method of the request object that is used for getting the name of all the header names existed in the current session environment of the page. This method returns all the header names in the enumeration form that are retrieved one by one by enumerating the data.

There is a example with the complete JSP code is provided by the section i.e. very helpful in developing your JSP application. You can directly copy from the page and paste it into your application.

Here is the JSP code of GetHeaderNamesMethod.jsp file:

<%@page import="java.util.*" %>
<table align="center" border="1" cellpadding="0" cellspacing="0" bgcolor="red">
<%
	String headername = "";
	for(Enumeration e = request.getHeaderNames(); e.hasMoreElements();){
		headername = (String)e.nextElement();
%>
	<tr>
		<td><b><%= headername %></b></td>
	</tr>
<%}%>

Output for the above JSP file:

Download 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: getHeaderNames() Method Of The Request Object   View All Comments

Post your Comment


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