You can find the full source code for this website in the Seam package in the directory /examples/wiki. It is licensed under the LGPL.
| Online: | 17 Members of 4546 |
| Forum: Seam Users |
19. Jun 2008, 12:38 CET | Link |
Hi,
first let me say that i'm a total beginner with Seam and JSF.
Anyway, i'm having a problem in a project that i'm involved with. I have this code on the page:
<h:outputLabel for="cb_add">Inserir:</h:outputLabel>
<h:selectOneMenu id="cb_add">
<s:selectItems var="addDefName" value="#{gestDocuments.addDefNames}" label="#{addDefName}" />
</h:selectOneMenu>
<h:commandButton id="bt_add" action="#{gestDocuments.add}" value="Inserir" />
On my component (It's a simple Java Bean) i have:
@Name("gestDocuments")
@Scope(ScopeType.SESSION)
public class GestaoDocumentsWS{
...
@DataModel
private List<String> addDefNames;
@DataModelSelection(value = "addDefNames")
private String addDefName;
The problem is that whenever i click the button, i want to get the String that was selected on the combobox and now it's always giving me the first item on the List.
What am i doing wrong?
Thank you
Alex
@DataModelSelection is not used with the UISelectOne component. It is used to capture the row in a UIData component (table) that received an action. You need to add a value binding to your UISelectOne to capture the selected value.
Dan Allen | mojavelinux.com | Author of Seam in Action
Thanks for your help Dan! It works now :)
Alex