Yes I am using Struts1.

On 9/9/2010 5:10 PM, Greg Lindholm wrote:
I "assumed" from his example that he was using Strut1.

Maybe he could tell us so we don't have to guess and give wrong info.


On Thu, Sep 9, 2010 at 4:53 PM, Dale Newfield<d...@newfield.org>  wrote:
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:

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

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).

http://struts.apache.org/2.2.1/docs/ognl.html
http://www.opensymphony.com/ognl/html/LanguageGuide/index.html

-Dale

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


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





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

Reply via email to