Java Mailing List Archive

http://www.junlu.com/

Home » Home (12/2007) » Struts 2 »

Re: [s2] how to make s:iterator work

cilquirm

2007-01-16

Replies:


I don't know particularly about the s:iterator, but since you said you're
using JSP, you can access the model via the jstl tags just as easily :

<c:forEach items="${listOfBooks}" var="book">
${book.author}
</c:forEach>


though, looking at your code again, I suspect it's because your getter is
class private.

It would have to be public.

-a



walidito wrote:
>
> Hi everybody.
> I have a problem with displaying a list of objects that I extract from a
> hibernate database. I' searching for the simpler and the better way to do
> it please.
> I have two issues :
>
> I am not sure about how to send it to the jsp. For the moment I am trying
> this one from my action :
>
> private List getListOfBooks() {
> ... // get books from Data Access Object classes
> }
>
> public String execute() throws Exception {
>                      ...
>    booklist = getListOfBooks();
>    this.request.setAttribute("listOfBooks", booklist);
>    return SUCCESS;
>  }
> In my jsp, i don't know how to display it.
> I tried many solutions without success among them :
>
> <s:iterator value="%{listOfBooks}">
>      <s:property value="%{author}"/>
> </s:iterator>
> which does not work.
>
> Help please !!
>

--
Sent from the Struts - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@(protected)
For additional commands, e-mail: user-help@(protected)

©2008 junlu.com - Jax Systems, LLC, U.S.A.