Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / General / March 2006

Tip: Looking for answers? Try searching our database.

Complex structure in JSTL

Thread view: 
Johnny - 14 Mar 2006 18:17 GMT
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/


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.