[jboss-user] [JBoss Seam] - selectOneMenu Question

KoniKoni do-not-reply at jboss.com
Sun Mar 25 07:11:43 EDT 2007


I shoud like to implement selection from first selectOneMenu, object of which is supplied contains
a list, this is spent with the second selectOneMenu.

The first menu functions and the second not, maybe somebody can help me.

Here is my code:


Component:

 <framework:entity-query name="allHer"
  |                             ejbql="select h from Hersteller h"
  |                             order="h.bezeichnung" >
  |     </framework:entity-query>  



View:



<ui:define name="main">
  |         <s:link value="zurueck" view="/home"/>
  |         
  |         <s:div>
  |             <a4j:region>
  |                 <s:div id="frm">
  |                     <a4j:form>
  |                         <h:selectOneMenu  value="#{hersteller}">
  |                             <s:convertEntity />
  |                             <s:selectItems value="#{allHer.resultList}" var="her" label="#{her.bezeichnung}" noSelectionLabel="Bitte waehlen..." />
  |                             <a4j:support event="onchange" action="#{fahrzeugact.setModel}" reRender="msg,frm1">
  |                             <s:conversationPropagation type="join" /> </a4j:support>
  |                         </h:selectOneMenu>
  |                         
  |                         
  |                     </a4j:form>
  |                 </s:div>
  |             </a4j:region>
  |             
  |             <a4j:region>
  |                 <s:div id="frm1">
  |                     <a4j:form>   
  |                         <h:selectOneMenu  value="#{kmd}" disabled="#{empty hersteller.kfzmodel}">
  |                             <s:convertEntity />
  |                             <s:selectItems value="#{hersteller.kfzmodel}" var="md" label="#{md.bezeichnung}" noSelectionLabel="Bitte waehlen..." />
  |                             <a4j:support event="onchange" action="#{fahrzeugact.setModel1}" reRender="msg">
  |                             <s:conversationPropagation type="join" /> </a4j:support>
  |                         </h:selectOneMenu>
  |                     </a4j:form>
  |                 </s:div>
  |             </a4j:region>
  |             
  |             
  |             <a4j:region> 
  |                 
  |                 <s:div id="msg"><h:messages globalOnly="false"/> </s:div>
  |             </a4j:region>
  |         </s:div>
  |     </ui:define> 
  | 
  | 
  | Session:
  | 
  | 
  | @Name("fahrzeugact")
  |   | @Stateful
  |   | public class Fahrzeug implements FahrzeugInterface {
  |   |     @DataModel
  |   |     private List<Hersteller> hrList;
  |   |     
  |   |      private List<Hersteller> hrsList;
  |   | 
  |   |      @In(required=false)
  |   |     private KfzModel kmd;
  |   |     
  |   |     @PersistenceContext
  |   |     private EntityManager em;
  |   |     
  |   |     @In(required=false)
  |   |     private Hersteller hersteller;
  |   |     
  |   |     
  |   |     
  |   |     @Begin
  |   |     public List<Hersteller> getHrsList() {
  |   |         return em.createQuery("from Hersteller where akzept = true").getResultList();
  |   |     }
  |   |  
  |   |     
  |   |     public void setModel(){
  |   |        // md
  |   |         System.out.println("--------------- " + hersteller.getBezeichnung());
  |   |     }
  |   |     
  |   |      public void setModel1(){
  |   |        // md
  |   | 
  |   |         System.out.println("--------------- 1 " + kmd.getBezeichnung());
  |   |     }
  |   |     
  |   |     @End
  |   |     public void reset() {}
  |   |     
  |   |     @Destroy
  |   |     @Remove
  |   |     public void destroy() {}
  |   | }
  |   | 


I believe that it is because of different contexts, I must in component.xml defined inquiry to tie, white however not how. And if I define the whole over factories, then over messages on the side one spends: invalid value.

I have the example ?UI? looked at, there am realized it over HomeEntity. How can I realize this completely on source code level, without HomeEntity?

	
Or think I there in wrong direction? 

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

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



More information about the jboss-user mailing list