Help

Controls

PermLinkWikiLink

Built with Seam

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.

Forum: Seam Users Forum ListTopic List
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.

5 Replies:
27. Jun 2008, 17:38 CET | Link

What's orgConverter? and can't you use


<s:convertEntity>

?

 
Dan Hinojosa Seam :: Groovy :: Swing Developer/Consultant/Instructor Albuquerque, NM
27. Jun 2008, 19:06 CET | Link
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;
}
02. Aug 2008, 02:57 CET | Link

I am facing the same issue dude... did u get the solution ??

02. Aug 2008, 03:45 CET | Link

Hi!

I am guessing your OrgBean.getAllOrg() method does not return a list of strings, but a list of object of type Org 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 Org type.

Regards,

 
Please don't forget to rate

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.

11. Dec 2008, 05:09 CET | Link
Hello,

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~