Mixing JSF and JSTL
Hi,
I'm having a little issue with combining JSTL and JSF.
I have a jsf selectOneMenu drop-down that I would like to fill with values stored in a bean. The bean is a Vector that contains objects of a certain type. The vector object is called Languages which carries objects of type Language. Each language object has an id, name and description.
I tried finding out by using only JSF tags how to loop through the Languages bean, but I found out that that isn't possible. I searched on the net and found an example that combines JSF and JSTL for looping and displaying the looped values in a selectOneMenu . I cusomized it to my own purposes which results in the following code:
// define the languages bean
<jsp:useBean id="LanguagesBean" class="MyPackage.Languages" scope="session">
<jsp:setProperty name="LanguagesBean" property= "initiated" value="true" />
</jsp:useBean>
// the actual code
<h:selectOneMenu id="lang" value="Languages" title="select a language"> <c:forEach var="languages" items="${LanguagesBean}">
<c:set var="languagesVar" value="${languages}" scope="request" /><f:selectItem itemValue="#{languagesVar.id}" itemLabel="#{languagesVar.description}" />
</c:forEach>
</h:selectOneMenu>
Somehow the output for each selectItem is the description of the last Language object in the Languages bean.
So, I tried to display the ouptut of it by using <c:out ../>. When using this way of displaying all thelanguage descriptions are displayed.
Is there a bug in using the var that is set in<c set../>? Is there an alternative way of looping through the languages object by using JSF and JSTL tags?
I'm using Sun's JavaServer Faces implementation (1.2_04-b07-FCS).
Hope someone can help. Thanks.

