This is the set-up: a document belongs to a category. Category is a class with an ID
(Integer - auto generated), a name and a description. One category can have many
documents.
A data table of documents is displayed. The category is in a selectOne and the name is
displayed. This is what it looks like in the view:
| <h:selectOneMenu id="category"
value="#{document.category.categoryID}" required="true">
| <f:selectItems value="#{categorySessionBean.categoryList}" />
| </h:selectOneMenu>
|
This is what an f:selecItem looks like:
| categoryList = new SelectItem[categories.size()];
| int i=0;
| for(Category cat:categories){
| categoryList(i)=new SelectItem(cat.getCategoryID(), cat.getName());
| i++;
| }
|
The () after categoryList should be square brackets. It is seen as formatting and
ignored.
I've tried s:selectItems and it doesn't work for me. I get and "invalid
value" when trying to do an update with it. Maybe the place holders have something
to do with it.
How can I use a selectOne to change the category of a document? The display is right, the
xhtml code is right, just it does not work.
Any help will be greatly appreciated.
View the original post :
http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4103175#...
Reply to the post :
http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&a...