[jboss-user] [JBoss Seam] - Seam 2.0 BETA : convertEntity / SelectOneMenu problem

vwiencek do-not-reply at jboss.com
Mon Aug 20 04:41:34 EDT 2007


Hi, 

I have some difficulties to use a selectOneMenu with Seam. 

I have a RegisterBean which containes the following ...

  | @Stateful
  | @Scope(ScopeType.SESSION)
  | @Name("register")
  | public class RegisterBean implements Register {
  |     ...
  |     @PersistenceContext
  |     private EntityManager em;
  |     ...
  |     
  |      @In (required = false)
  |      private City selectedCity;
  | 
  |      public List<City> getCities() {
  |      ...
  |      }
  | }
  | 

My bean interface contains


  | @Local
  | public interface Register {
  |     ....
  |     public List<City> getCities();
  | 
  | }
  | 

My register.xhtml file contains 


  | <!DOCTYPE composition PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
  |                              "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  | <ui:composition xmlns="http://www.w3.org/1999/xhtml"
  |                 xmlns:s="http://jboss.com/products/seam/taglib"
  |                 xmlns:ui="http://java.sun.com/jsf/facelets"
  |                 xmlns:f="http://java.sun.com/jsf/core"
  |                 xmlns:h="http://java.sun.com/jsf/html"
  |                 xmlns:rich="http://richfaces.ajax4jsf.org/rich"
  |                 xmlns:a="https://ajax4jsf.dev.java.net/ajax"
  |                 template="layout/template.xhtml">
  | ....
  |      <h:selectOneMenu 
  |           id="selectedCity"
  |           value="#{selectedCity}" 
  |           required="false">
  | 						
  |                <s:selectItems 
  |                     value="#{register.cities}" 
  |                     var="c"
  |                     label="#{c.postalCode} - #{c.name}" 
  |                     noSelectionLabel="Select a City" />
  |                <s:convertEntity />
  |      </h:selectOneMenu>
  | ...
  | </ui:composition>
  | 
  | 

Now, when I try to access my form, the combobox displays with my list of cities, but when I submit the form, I get a null value into register.selectedCity ... and I can't get rid of that problem.

Behind this, I'm asking whether I must use @DataModel (for my list of cities) and @DataModelSelection for my selectedCity value.

Thanks a lot.

Vincent

View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4075697#4075697

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4075697



More information about the jboss-user mailing list