Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

need help with taglib

praneethpraneeth Member Posts: 21
hi all,

i need help rendering an ArrayList of HashMaps.

Problem:

I created a ArrayList of HashMaps in the action class and set it in session. Now i need to display it in the JSP. i tried all the taglib options was not able to do it.

Using scriplets i could do it.... here is the scriptlet code....

=====================================
<%

//Array list for getting the arraylist from the session

java.util.ArrayList arrlist = new java.util.ArrayList();
arrlist=(java.util.ArrayList)session.getAttribute("resultList");

//HashMap to take the hashmap from the arraylist

java.util.HashMap hash = new java.util.HashMap();
int i, arraysize,hashsize;
Object transactionId;
java.util.Set keys;
java.util.Iterator iter;
if(arrlist!=null)
{
i=0;
//Calculating the size of the arraylist to control the execution
arraysize=arrlist.size();
if(arraysize == 0)
{
%>

<%
}else{
System.out.println(arraysize);
//Iterator to iterate throught the arraylist
java.util.Iterator iterator = arrlist.iterator ();
%>



<%
while(iterator.hasNext()&& (arraysize>0)){
//getting the hashmap from the arraylist and extracing the information to display in the table
hash = (java.util.HashMap)arrlist.get(i);
hashsize=hash.size();
keys = hash.keySet();
iter= keys.iterator();
i++;
arraysize--;
transactionId=hash.get("ID");
%>
<%

}
session.setAttribute("resultList",null);
// For making the checkbox clicked default and the default value is "Today"
%>
Txn ID Txn GUID Date Type Of Activity Status code
"><%=transactionId%> <%=hash.get("TRNXN_GUID")%> <%=hash.get("TRNXN_DATE")%> <%=hash.get("DB_TRNXN_TYPE_ID")%> <%=hash.get("TRNXN_STAT")%>
<%
}
}
else{} %>

==================================================

now how can i do the same with taglibs. i mean some thing like inside ..i guess.

please help.

Sign In or Register to comment.