Hello everyone,
I have a difficult question about JSTL.
I have following strutures in my WebApp but I don't know how to
reterieve data from it using JSTL.
So first, I have a container class for data. Code snippet is below.
It contains different objects stored by key value.
public class UserResponse extends Hashtable
{
public UserResponse(){
}
// Getter
public Object getResponse(String key) {
return get(key);
}
// Setter
public void setResponse(String key, Object value) {
put(key, value);
}
}
Then I have a ordinary SessionBean like this
public class SessionInfoBean implements java.io.Serializable
{
private String SessionID;
private String RowRecord;
private String RowNumber;
...
and I read them from database and store them into an ArrayList.
like this way
ArrayList SessionsList = new ArrayList();
while (rs.next())
{
SessionInfoBean sessionInfoBean = new SessionInfoBean();
sessionInfoBean.setSessionID(rs.getString("sessionid"));
sessionInfoBean.setRowNumber(Long.toString(rs.getLong("row_number")));
sessionInfoBean.setRowRecord(rs.getString("rowrecord"));
SessionsList.add(sessionInfoBean);
}
Then I store the ArrayList of SessionInfoBean intems into UserResponse
object that is descripted in the beginning this message. Code look like
this:
userResponse.setResponse(Constants.DATA_BY_ID, (Object) SessionsList);
The question is: Can I iterate all properties that are in ArrayList stored
into SessionInfoBean items using JSTL?
Is this too complex or can it be resolved?
Thanks!
josh.s17@gmail.com - 14 Mar 2006 21:28 GMT
It is very easy to iterate though a collection in JSTL. This link has
all the details you need.
http://www-128.ibm.com/developerworks/java/library/j-jstl0318/
Johnny - 15 Mar 2006 20:44 GMT
Thanks, this document seems to very clear.
Cheers!
> It is very easy to iterate though a collection in JSTL. This link has
> all the details you need.
>
> http://www-128.ibm.com/developerworks/java/library/j-jstl0318/