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: | 16 Members of 4546 |
| Forum: Seam Users |
27. Jun 2008, 12:39 CET | Link |
I can't get the value of selectItems in stateless ejb as below:
<h:selectOneMenu id="selOrg" value="#{MyBean.selOrg}" >
<s:selectItems value="#{OrgBean.allOrg}" var="org" label="#{org.name}" noSelectionLabel=" -- Select --" />
<f:converter converterId="orgConverter"/>
</h:selectOneMenu>
and I can get it from:
<h:selectOneMenu id="selOrg" value="#{MyBean.selOrg}" >
<f:selectItem itemLabel="-- select --" itemValue=""/>
<f:selectItem itemLabel="Myorg" itemValue="1"/>
</h:selectOneMenu>
But I need to the dynamic list, how to fix it? thanks.
What's orgConverter? and can't you use
?
orgConverter is my converter class,it works fine, my issue is: When I submit the page, invoke a MyBean method, in this method, I need the selected value from s:selectItems, but I can't get it, it's null, the set method doesn't work. set method as below: public void setSelOrg(String selOrg) { this.selOrg = selOrg; }I am facing the same issue dude... did u get the solution ??
Hi!
I am guessing your OrgBean.getAllOrg() method does not return a list of strings, but a list of object of type therefore, you should be using <s:convertEntity> (as Daniel suggested) and you set method (setSelOrg) should not receive a string, it should receive an object of type.
Regards,
I believe that imagination is stronger than knowledge -- myth is more potent than history -- dreams are more powerful than facts -- hope always triumphs over experience -- laughter is the cure for grief -- love is stronger than death.
What if your list of items you are passing to s:selectItems is not an enumeration OR a POJO annotated with @Entity?
<s:convertEntity/> throws an exception if the items in the list aren't an entity.
What I am trying to do is similar to what the original post in this thread stated:
<h:selectOneMenu value="#{value}">
<s:selectItems value="#{bean.choices}"
var="choice"
label="#{choice.label}" />
<s:convertEntity/>
</h:selectOneMenu>
The issue is that #{bean.choices} returns a list of "choice" objects that have a few attributes and a getLabel() method. The "choice" class, however, is not an Entity and has no table behind it.
The #{bean.choices} list is populated by a service call.
Do you know of any way to make a POJO an Entity without mapping it to a table so I can use the s:convertEntity tag?
OR
Do you know of any way to force the s:selectItems to use a specific converter?
Thanks,
#25
~BOB~