10 Replies Latest reply on Mar 26, 2007 11:37 AM by pmuir

    selectOne

    konikoni

      I don's now what i do wrong:

      @Name("fahrzeugact")
      @Stateful
      public class Fahrzeug implements FahrzeugInterface {
       @DataModel
       private List<Hersteller> hrList;
      
       @DataModelSelection("hrList")
       private Hersteller selectedHer;
      
       @PersistenceContext
       private EntityManager em;
      
       @In(required=false)
       private Hersteller hersteller;
      
       @Begin(join=true)
       @Factory("hrList")
       public void getHer(){
       hrList = em.createQuery("from Hersteller where akzept = true").getResultList();
      
       }
       public void setModel(){
       System.out.println("--------------- ");
       }
      
       @End
       public void reset() {}
      
       @Destroy
       @Remove
       public void destroy() {}
      }
      
      }



       <a4j:region>
       <s:div id="frm">
       <a4j:form>
      
       <h:selectOneMenu value="#{hersteller}" required="true">
       <s:convertEntity />
       <s:selectItems value="#{hrList}" var="her" label="#{her.bezeichnung}" noSelectionLabel="Bitte waehlen..."/>
       <a4j:support event="onchange" action="#{fahrzeugact.setModel}"/>
       </h:selectOneMenu>
      
      
       </a4j:form>
       </s:div>
       </a4j:region>
      
       <a4j:region>
       <s:div id="msg"><h:messages globalOnly="false"/> </s:div>
       </a4j:region>
      



      I get i error "Invalid Value".

        • 1. Re: selectOne
          stu2

           

          "KoniKoni" wrote:
          I don's now what i do wrong:

           <a4j:region>
           <s:div id="frm">
           <a4j:form>
          
           <h:selectOneMenu value="#{hersteller}" required="true">
           <s:convertEntity />
           <s:selectItems value="#{hrList}" var="her" label="#{her.bezeichnung}" noSelectionLabel="Bitte waehlen..."/>
           <a4j:support event="onchange" action="#{fahrzeugact.setModel}"/>
           </h:selectOneMenu>
          
          
           </a4j:form>
           </s:div>
           </a4j:region>
          



          I get i error "Invalid Value".


          For one it looks like you want <h:selectOneMenu value="#{selectedHer}" required="true">


          Take a look at the ui example application to see this stuff working in action.

          • 2. Re: selectOne
            konikoni

            if declared the List in componets.xml does work,

            but i have to select the second selectOne by parameter form the first selectOne

            and the ui example don't provide such, or i don't understand it?

            • 3. Re: selectOne
              konikoni

              I want to make follow:

              User choise from a selectOneMenu a category

              and the select selectOneMenu shows the films of selected category,

              how can i make that, the ui example provide just declarations from conponents.xml?

              • 4. Re: selectOne
                cdigiovanni

                hello, i have the same problem. If you got a solution to the problem can you post it? Thank you!

                • 5. Re: selectOne
                  pmuir

                  KoniKoni, take a look at the ui example in CVS, it shows the country selectOneRddio being populated from a property of continent.

                  • 6. Re: selectOne
                    konikoni

                    This stuff just functions with EnityHome. Shoud be the EntityBean for selectOne from EtityHome extended?

                    • 7. Re: selectOne
                      pmuir

                      No, you never extend an entity from EntityHome. EntityHome is part of the Seam Application Framework (see the documentation.

                      I wrote the example using the framework but it works just fine without it (all the framework is doing is making it easier to do persistence - update and queries).

                      You'll probably find it much easier to get this working without a4j and then add it in later - it works fine with a4j:support, doing what you want.

                      • 8. Re: selectOne
                        konikoni


                        I used follow code:

                        <framework:entity-home name="kfzHome" entity-class="kk.rentform.entity.Kfz" />


                        without extending from HomeEntity doesn't work.

                        Probably because i used <s:convertEntity />?

                        • 9. Re: selectOne
                          konikoni

                          If i defined follow:

                          <framework:entity-home name="kfzHome" entity-class="kk.rentform.entity.Kfz" />

                          how can i include this entity home with @In annotation?

                          • 10. Re: selectOne
                            pmuir

                            @In EntityHome kfzHome

                            Nothing in seam-ui is dependant on the framework.