struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Wendy Smoak <Wendy.Sm...@asu.edu>
Subject RE: Iterate through resultset
Date Thu, 21 Nov 2002 20:55:31 GMT
> I'm working on this application where I get resultsets in jsp pages from
> business objects. 

I do a similar thing, but I have a DAO layer return a Collection of Value
Objects.  (How's that for getting a bunch of pattern buzzwords into one
sentence?)  The VO's are beans, so I can get at the properties with <c:out>
(or <bean:write> I think was the old way).

The view never sees anything database specific, it just gets a Collection
of, say, ResolutionView objects.  (This is a list of possible matching
records based on a free-form text name the user has entered.  The Action has
put the Collection into request scope.)

<logic-el:iterate id="resView" 
                name="foundPersons" 
                type="edu.asu.vpia.value.ResolutionView" 
               scope="request">
   <c:out value="${resView.key}"/>
   <c:out value="${resView.preferredName}" />
   
   <c:set var="addressList" value="${resView.preferredAddress}" scope="page"
/>
       <logic-el:iterate id="addressLine" name="addressList">
         <c:out value="${addressLine}"/>
       </logic-el:iterate>
   
   <c:out value="${resView.statusDesc}" />
</logic-el:iterate>

Maybe one day you will move away from a SQL database, and you won't have a
"ResultSet" anymore.  This way, you only have to make changes to the layer
of code that provides the Collection and nothing in the view is affected.
To the JSP, it's all Strings.

Take all that for what it's worth... I'm _very_ new at this.

-- 
Wendy Smoak
Applications Systems Analyst, Sr.
Arizona State University PA Information Resources Management

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message