Core Java| JSP| Servlets| XML| EJB| JEE5| Web Services| J2ME| Glossary| Questions?

 

 

 

 

 

 

 

 

 

 

 

 

 

Search Tutorials

Latest Questions
Comments
 
JSP Enumeration 
 

Enumeration, a concept of core java is an object that implements the Enumeration interface generate a series of elements, one at a time.

 

JSP Enumeration

                          

Enumeration, a concept of core java is an object that implements the Enumeration interface generate a series of elements, one at a time. Each call to the nextElement method ( ) will return the successive elements of the series.

Understand with Example

In this section we are going to display the days of week using the Enumeration in jsp. An Enumeration object generates a series of elements, one at a time which is used for passing through a collection. You can see in the given example that we have used the method add() of class Vector in order to append the days name to the end of this Vector.

v.elements()-The method returns an enumeration of the elements of the vector.

e.hasMoreElements() - This method returns true, until the last object has been returned by nextElement().

e.nextElement()- This method returns the next object in the collection.

Here is the code of enumerations.jsp

<%@ page import="java.util.*"%>
<html>
<body>
<% 
Enumeration e;
Vector v = new Vector();
v.add("Sunday");
v.add("Monday");
v.add("Tuesday");
v.add("Wednesday");
v.add("Thursday");
v.add("Friday");
v.add("Saturday");
out.println("<b>Days of Week:</b>"); 
e = v.elements();
while (e.hasMoreElements())
out.println(e.nextElement()); 
%>
</body>
</html>

Output will be displayed as:

Download Source Code:

 

                          

» View all related tutorials
Related Tags: c exception error jsp io count page using invoke js handle if to ci counter e directive can pe ce

Leave your comment:

Name:

Email:

URL:

Title:

Comments:


Enter Code:

Audio Version
Reload Image
 

Note: Emails will not be visible or used in any way, and are not required. Please keep comments relevant. Any content deemed inappropriate or offensive may be edited and/or deleted.

No HTML code is allowed. Line breaks will be converted automatically. URLs will be auto-linked. Please use BBCode to format your text.

Add This Tutorial To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Training Courses
Tell A Friend
Your Friend Name
Software Solutions
Least Viewed
Most Rated
Recently Viewed
Search Tutorials

 

 
 

Home | JSP | EJB | JDBC | Java Servlets | WAP  | Free JSP Hosting  | Search Engine | News Archive | Jboss 3.0 tutorial | Free Linux CD's | Forum | Blogs

About Us | Advertising On RoseIndia.net  | Site Map

India News

Indian Software Development Company | iPhone Development Company in India | Flex Development Company in India | Java Training Delhi | Java Training at Noida |

Send your comments, Suggestions or Queries regarding this site at roseindia_net@yahoo.com.

Copyright © 2008. All rights reserved.