You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by "Zimmerman, Steven R." <sr...@DOC1.WA.GOV> on 2003/07/17 20:47:34 UTC

Returning data from a ResultSet (via a Collection) to my jsp page ...

> I am a Struts newbie and that being the case I can't seem to get the data
> from my database back to my view. I realize that there are software
> packages that will help me do this (i.e. Scaffold) but I would like to be
> able to do this the vanilla way and then integrate the other more complex
> items later. Anyway... in my Action class I get the ResultSet and place
> the data in a Collection. How does this pointer get back to my jsp?  I
> have searched but can't quite find the right answer with a code example
> and am unable to get this to work... :)  My Action page I believe is fine,
> it is just how to reference it in the jsp.
> 
>  Thanx, Steve
> 

---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org


Re: Returning data from a ResultSet (via a Collection) to my jsp page ...

Posted by Rick Reumann <r...@reumann.net>.
On Thu, Jul 17,'03 (11:47 AM GMT-0700), Zimmerman, wrote: 

>   My Action page I believe is fine, it is just how to
> > reference it in the jsp.
> > 
 
<c:forEach var="item" items="${nameOfCollectionInScope}">
 	<c:out value="${item.fieldNameInBeanFromCollection}"/><br>
</c:forEach>

So, say a Collection of Employee beans called "employees" is in scope...

<c:forEach var="employee" items="${employees}">
 	<c:out value="${employee.name}"/><br>
	<c:out value="${employee.address}"/><br>
</c:forEach>

You can do a similar thing using Struts logic:iterate tag. Plenty of
examples of this floating around.

-- 
Rick



---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org