In this tutorial, we will introduce you to about the iterator tag. Iterator tag is used to iterate over a value. An iterable value can be either of: java.util.Collection, java.util.Iterator. We use the iterator tag to iterator over the collection of Integers. Here the integer property is of type ArrayList.
Description of login validation example:
1- index.jsp ADS_TO_REPLACE_1
<html>
|
2-IteratorTagAction.java
It display a user interface for login user.
Which takes the user input.
package roseindia;
|
struts.xml
It is a XML file. Here, we will create action mapping of action class.
<?xml version="1.0" encoding="UTF-8"?>
|
iterator.jsp
If execute method of LoginValidation class returns success then it
will display, otherwise error.jsp page will be display. It also also displayed
username and password of login user.
<html> <head>ADS_TO_REPLACE_2 <%@ taglib uri="/struts-tags" prefix="s" %> <title>Value of iterator </title> </head>ADS_TO_REPLACE_3 <body> <h2>Iterator tag of Struts2.2.1</h2> Elements of ArrayList Collection.....ADS_TO_REPLACE_4 <s:iterator value="obList"> <s:property /> <br />ADS_TO_REPLACE_5 </s:iterator> </body> </html> |
index.jspADS_TO_REPLACE_6
iterator.jsp
ADS_TO_REPLACE_7
Advertisements
Ads
Ads