Explain the use of logic:iterate tag in struts application

Explain the use of <logic:iterate> tag in struts application

The tag is utilized for repeating the nested body content over a collection. Every element / object in a specified collection – which must be any one of – Iterator, Collection and Map or even an array – and their contents are nested in this tag.

The iterable collection must be specified in any one of the following methods:

- As a runtime expression that is specified as a value of the ‘collection’ attribute
- As a JSP bean that is specified by the ‘name’ attribute
- As the property that is specified by the ‘property’ of the JSP bean specified by the ‘name’ attribute.

Usually, every object that is exposed by the iterate tag is an object of the underlying collection that is to iterate over. In case a Map is to iterate, the exposed object should be of the type Map.Entry, which has two properties – i) key – the key under which the object / element is stored in a Map – ii) value – the value of corresponding key.

The following example depicts the usage of Hashtable that is to iterate:
<logic:iterate id="account" name="bankaccountnums">
Next account no is <bean:write name="account" property="value"/>
</logic:iterate>
Difference between DataInputStream and BufferedReader
The differences are: The DataInputStream works with the binary data, while the BufferedReader work with character data...
Difference between throw and throws - Java
The throw key word is used to explicitly throw an exception, while throws is utilized to handle checked exceptions for re-intimating the compiler that exceptions are being handled...
Explain the ways to serialize the java object
Object serialization could be used in different ways: - Simple persistence of the object...
Post your comment