struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "CRANFORD, CHRIS" <Chris.Cranf...@setech.com>
Subject RE: Managing code between Action Class and JSP.
Date Fri, 10 Sep 2010 13:27:37 GMT

As others indicated, it's a matter of using the Struts/JSTL tags.

  <ul>
    <logic:iterate id="aFoo" name="resultObjects">
      <li><bean:write name="aFoo" property="propertyName"/></li>
    </logic:iterate>
  </ul>

The biggest difference between Struts1 and what what is posted
below for Struts2 is how you pass the data to the JSP in my 
opinion.

In Struts1, you would still do as you had in your original
post:

  request.setAttribute("resultObjects", resultList);

But instead of using the <% ... %> JSP tags, you would much rather
using the JSTL, Bean, Logic, Html tag libraries accordingly.  They
will keep your JSP pages clean and much easier to read.

HTH,
Chris

> -----Original Message-----
> From: Anjib [mailto:anjibcs@hotmail.com]
> Sent: Thursday, September 09, 2010 6:27 PM
> To: Struts Users Mailing List
> Subject: Managing code between Action Class and JSP.
> 
> 
>   Yes I am using Struts1.
> 
> On 9/9/2010 5:10 PM, Greg Lindholm wrote:
> >>
> >> <ul>
> >>   <s:iterator value="%{resultObjects}" var="aFoo">
> >>     <li><s:property value="%{#aFoo.propertyName}" /></li>
> >>   </s:iterator>
> >> </ul>


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


Mime
View raw message