Java Object Declaration
Assume that the declaration was on servlet class that the getListMapmethod can access on your JSP file.
public List<Map<String, String>> getListMap(String pRatingCriteria){ List<Map<String, String>> myList = new ArrayList<Map<String,String>>(); Map<String, String> myMap = null; myMap = new HashMap<String, String>(); myMap.put("fname", "Winzter"); myMap.put("lname", "Corpuz"); myList.add(myMap); myMap = new HashMap<String, String>(); myMap.put("fname", "Winzter"); myMap.put("lname", "Corpuz"); myList.add(myMap); myMap = new HashMap<String, String>(); myMap.put("fname", "Juan"); myMap.put("lname", "Dela Cruz"); myList.add(myMap); return myList; }
Here your JSP code to iteration the List Map
<s:iterator var="myMap" value="getListMap()" status="rowStatus"> <tr> <td><s:property value="key" /></td> <td><s:property value="value" />%</td> </tr> </s:iterator>
No comments:
Post a Comment