Home | Ajax | BioInformatics | Dojo | EAI | EJB | Hibernate | J2ME | Java | Java Glossary | Java Servlets | JavaScript | Jboss | JDBC | JDO | Jmeter | JSF | JSP | JUnit | Maven | MySQL | Spring Framework | SQL | Struts | Technology | WAP | Web Services | XML


 
  
 
Programming Tutorials: Ajax | Articles | JSP | Bioinformatics | Database | Free Books | Hibernate | J2EE | J2ME | Java | JavaScript | JDBC | JMS | Linux | MS Technology | PHP | RMI | Web-Services | Servlets | Struts | UML
 

 
Facing Programming Problem?
Ask Questions?, Browse Latest Questions, Question-Answer Guidelines
JSP
  JDO Tutorials
  EAI Articles
  Struts Tutorials
  Java Tutorials
  Java Certification
  Java Applet
Questions
Comments

Nested <c:forEach> in JSTL

                          

The JSP Standard Tag Library (JSTL) core library, provides custom tags for basic functionality. Instead of using those hardcoded scriptlet, It allows you to program your pages using tags. While using the scriptlet, as the program grows bigger it becomes difficult to understand the program, and later in case if any programmer wants to change any module or part of  a code, then it becomes very difficult in understanding the program. Here comes the use of the JSTL, which allows you to program the pages using tags. Now if a programmer wants any change in the code, he can change it in the tag itself.  JSTL can do nearly everything that the JSP scriptlet can do.

<c:forEach> tag is a simple way to iterate over arrays and collections. This tag is very much similar to for loop. The tag repeats the body of the tag for each element in the array or collection. The nested <c:forEach> is same as loop inside the loop. This tag can be used for more complex loops.

The code of the program is given below:

 

<%@ taglib prefix = "c" uri = "http://java.sun.com/jstl/core"%>
<%@ page import = "java.util.*"%>
<%Integer[] int1 = {1, 2, 3,4,5};
Integer[] int2 = {10,20,31,40,50};
List numbers = new ArrayList();
numbers.add(int1);
numbers.add(int2);
request.setAttribute("number", numbers);
%>
<html>
<body bgcolor="#FFFFCC">
<center>
	<table>
		<c:forEach var = "listElement" items = "${number}">
			<c:forEach var ="number" items = "${listElement}">
			<tr>
				<font color="#000080"><td>${number}</td></font>
			</tr>
			</c:forEach>
		</c:forEach>
	</table>
</center>
</body>
</html>

The output of the program is given below:

Download this example.

 

                          

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 
Latest Searches:
ะà¸?ะà¸?ะà¸?ะà
spring eclipse tutoria
spring eclipse toturia
Ñ?â??â???Ñ?â??â??Ñ?â??
change password using
how to store data in a
AÑ?â??â??Ñ?â????Ñ?â??â
Introduction to jquery
Copy One Database Tabl
julian date to georgia
map iteration in jstl
coding of radio button
spring eclipse
change password using
program for display th
placement automation s
delete files
Copy One Database Tabl
dot prodoct matrix
tracking technology
Struts1.1 example down
jQuery To Hide the Div
JDBC and Mysql
read how many words on
examples of sql
Stateful
xml,stringbuffer
jsp access model
tree
getter setter methods
Ñ?â??г?Ñ?â??вÑ?â???Ñ
toturial concept
Linux Caixa MÃ? Ã? Ã
JSF editor
AÑ?â?£?Ñ?â???Ñ?â???Ñ?â
download file struts2
add a list box in a fo
insert data to text fi
String to array in jav
Photoshop Drawing Draw
JSP validations
j2ee api
FileInputStream
how to set vertical sc
binary to decimal
Dà¹?à¸?à¸?à¹?à¸??à¹?à¸
coding for dynamic dro
<sysproperty>
Logical OR
breakÑ?â??â??Ñ?â???Ñ?â
mouse events JTable
from
populate drop down fro
matrix subtraction
Photoshop Web Graphics
Flash Actionscripting
Hospital
build.xml <syspropert
bitsets in collections
dojo Spring
>= 0
j2me test
Constructor Inheritanc
??????????????????????
value change listener
point of interest geo
Java Count Vowels
check character progra
java program for Creat
(<=fico<=300)
using c linear search
Date
Photoshop Photo Effect
Convert Date to Long
Visual Basic Date and
JQUERY
Building
file uploading code us
breakÑ?â??â??Ñ?â???Ñ?â
coding of radio button
Java String toLowerCase Example
Java String toCharArray Example
Java String substring Example
Java String indexOf Example
Java String startsWith Example
Java String hashCode Example
Java String matches Example
Java String length Example
Java String lastIndexOf Example
Java String isEmpty Example
Java String equalsIgnoreCase Example
Java String equals Example
Java String endsWith Example
Java String copyValueOf Example
Java String contentEquals Example
  EAI Articles
  Java Certification
Tell A Friend
Your Friend Name
Search Tutorials

 

 
 
Browse all Java Tutorials
Java JSP Struts Servlets Hibernate XML
Ajax JDBC EJB MySQL JavaScript JSF
Maven2 Tutorial JEE5 Tutorial Java Threading Tutorial Photoshop Tutorials Linux Technology
Technology Revolutions Eclipse Spring Tutorial Bioinformatics Tutorials Tools SQL
 

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 | 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.