struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Dale Newfield <>
Subject Re: Managing code between Action Class and JSP.
Date Thu, 09 Sep 2010 20:53:06 GMT
On 9/9/10 4:12 PM, anjibman wrote:
> What I am really struggling in is I have processing result in the form of
> List of objects.

> What would be the best practice to send such list to JSP ready to grab.

Best practice is to store it inside the action, and add a getter to your 
action that returns the list:

public List<Foo> getResultObjects()

Then in the jsp use tags like these:

   <s:iterator value="%{resultObjects}" var="aFoo">
     <li><s:property value="%{#aFoo.propertyName}" /></li>

The language used inside those %{} is called OGNL (Object Graph 
Navigation Language).  It can access data held either in a named map 
(aFoo for example, addressed with a #) or by searching the "value stack" 
(which typically has the action as the top item, so resultObjects winds 
up calling your action's getResultObjects() method).


To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message