|
Thanks Bruno Aranda,
The only thing is that I want to display a HashMap
and not a List (I should have mentioned that in my email) and I don't want to
render it as a table. This is why I was using jstl. Any other clue?
Julien.
----- Original Message -----
Sent: Tuesday, May 24, 2005 10:00
PM
Subject: Re: Displaying simple read-only
tabular data
Hi Julien,
Mixing JSTL and JSF is not a good idea. I
think what you are looking for is the dataTable component. You can use
something like this:
<h:dataTable value="#{AlbumsAction.myList}"
var="item"> <h:column>
<h:outputText value="#{item}"/>
</h:column> </dataTable>
Also, I would put the list
populating code in the constructor of the bean and not in the setter method.
Hope this helps,
Bruno
2005/5/24, Julien Martin <[EMAIL PROTECTED]>:
Hello,
I
am relatively new to JSF and I am stuck on a basic problem. I want a
jsp page to diplay simple read-only tabular data. I just want the
index.jsp page to retrieve data from a bean without going through an
action nor to have any navigation rule associated to it.
I want
the jsp to be roughly as follows (using the forEach
tag):
[code]
<c:forEach items="${AlbumsAction.myList}"
var="item">
<c:out value="${item}"/>
</c:forEach>
[/code]
My bean would be roughly as
follows:
[code]
package
com.pedrolo.adriana.albums;
public class AlbumsAction
{
private List myList;
public List getMyList() {
myList = new
ArrayList();
myList.add("toto");
myList.add("titi");
return
myList;
}
public void setMyList(List myList)
{
this.myList = myList;
}
}
[/code]
In
addition I have the following in the
DD:
[code]
<managed-bean>
<managed-bean-name>AlbumsAction</managed-bean-name>
<managed-bean-class>com.pedrolo.adriana.albums.AlbumsAction
</managed-bean-cl ass>
<managed-bean-scope>request</managed-bean-scope>
</managed-bean>
[/code]
This
does not seem to work. Can anyone help please??
Thanks in advance,
Julien.
|
- Re: Displaying simple read-only tabular data Julien Martin
-