7 Replies Latest reply on Jul 1, 2009 11:54 PM by scott duke

    selectOneMenu on Search Screen

    scott duke Novice

      I have a seam generated search screen that contains several selectOneMenus. On my edit screens the selectOneMenus work fine. On my search screen the selectOneMenus do not work.


      I would like to point out, two of my selectOneMenus access different list of codes from my code entity.


      I have tried using convertEntity, but I get an exception.
      I have tried creating a converter, but that does not seem to work.
      I have tried creating a MyEntityIdentifierStore, but I keep getting the exception cannot be cast to EntityIdentifierStore.


      Why does the convertEntity not work on a search screen?
      Should I use a converter or EntityIdentifierStore?



                   <s:decorate id="mediumDecoration" template="layout/display.xhtml">
                      <ui:define name="label">Medium</ui:define>               
                        <h:selectOneMenu id="codeMedium"
                                   styleClass="selectOneMenu"
                                      value="#{editionHome.instance.medium}">
                             <s:selectItems value="#{codeList.mediumCodes}" var="_codeMedium" label="#{_codeMedium.code}" 
                                               noSelectionLabel=" "/>
                          <f:converter converterId="mediumCodeConverter" />
                             <a:support event="onblur" reRender="mediumDecoration" ajaxSingle="true" bypassUpdates="true"/>
                        </h:selectOneMenu>
                   </s:decorate> 
                   
                   <s:decorate id="editionDecoration" template="layout/display.xhtml">
                      <ui:define name="label">Edition</ui:define>               
                        <h:selectOneMenu id="codeEdition"
                                   styleClass="selectOneMenu"
                                      value="#{editionHome.instance.edition}">
                             <s:selectItems value="#{codeList.editionCodes}" var="_codeEdition" label="#{_codeEdition.code}" 
                                               noSelectionLabel=" "/>
                          <f:converter converterId="editionCodeConverter" />
                             <a:support event="onblur" reRender="editionDecoration" ajaxSingle="true" bypassUpdates="true"/>
                        </h:selectOneMenu>
                   </s:decorate>     
      


        • 1. Re: selectOneMenu on Search Screen
          Pete Muir Master

          How does it not work?

          • 2. Re: selectOneMenu on Search Screen
            scott duke Novice

            When I use:



                         <s:decorate id="mediumDecoration" template="layout/display.xhtml">
                            <ui:define name="label">Medium</ui:define>               
                              <h:selectOneMenu id="codeMedium"
                                         styleClass="selectOneMenu"
                                            value="#{editionList.edition.medium}">
                                   <s:selectItems value="#{codeList.mediumCodes}" var="_codeMedium" label="#{_codeMedium.code}" 
                                                     noSelectionLabel=" "/>
                                     <s:convertEntity />
                                   <a:support event="onblur" reRender="mediumDecoration" ajaxSingle="true" bypassUpdates="true"/>
                              </h:selectOneMenu>
                         </s:decorate> 
            



            I receive the following on my search screen:



            model validation failed:javax.el.PropertyNotFoundException: Target Unreachable, 'medium' returned null on 'com.ds.artwork.entity.Edition'
            



            And in the log file:



            07:35:59,921 WARN  [Param] could not create converter for: medium
            javax.el.PropertyNotFoundException: Target Unreachable, 'medium' returned null on 'com.ds.artwork.entity.Edition'
                 at org.jboss.el.parser.AstPropertySuffix.getTarget(AstPropertySuffix.java:40)
                 at org.jboss.el.parser.AstValue.getTarget(AstValue.java:47)
                 at org.jboss.el.parser.AstValue.getType(AstValue.java:28)
                 at org.jboss.el.ValueExpressionImpl.getType(ValueExpressionImpl.java:174)
                 at org.jboss.seam.core.Expressions$1.getType(Expressions.java:127)
                 at org.jboss.seam.navigation.Param.getConverter(Param.java:65)
                 at org.jboss.seam.navigation.Param.convertValueFromString(Param.java:205)
                 at org.jboss.seam.navigation.Pages.convertAndValidateStringValuesInPageContext(Pages.java:748)
                 at org.jboss.seam.navigation.Pages.postRestore(Pages.java:402)
                 at org.jboss.seam.jsf.SeamPhaseListener.postRestorePage(SeamPhaseListener.java:546)
                 at org.jboss.seam.jsf.SeamPhaseListener.afterRestoreView(SeamPhaseListener.java:392)
                 at org.jboss.seam.jsf.SeamPhaseListener.afterServletPhase(SeamPhaseListener.java:228)
                 at org.jboss.seam.jsf.SeamPhaseListener.afterPhase(SeamPhaseListener.java:194)
                 at com.sun.faces.lifecycle.LifecycleImpl.phase(LifecycleImpl.java:280)
                 at com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:117)
                 at javax.faces.webapp.FacesServlet.service(FacesServlet.java:244)
                 at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
                 at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
                 at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:83)
                 at org.jboss.seam.web.MultipartFilter.doFilter(MultipartFilter.java:85)
                 at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
                 at org.jboss.seam.web.ExceptionFilter.doFilter(ExceptionFilter.java:64)
                 at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
                 at org.jboss.seam.web.RedirectFilter.doFilter(RedirectFilter.java:45)
                 at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
                 at org.ajax4jsf.webapp.BaseXMLFilter.doXmlFilter(BaseXMLFilter.java:154)
                 at org.ajax4jsf.webapp.BaseFilter.handleRequest(BaseFilter.java:260)
                 at org.ajax4jsf.webapp.BaseFilter.processUploadsAndHandleRequest(BaseFilter.java:366)
                 at org.ajax4jsf.webapp.BaseFilter.doFilter(BaseFilter.java:493)
                 at org.jboss.seam.web.Ajax4jsfFilter.doFilter(Ajax4jsfFilter.java:56)
                 at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
                 at org.jboss.seam.web.LoggingFilter.doFilter(LoggingFilter.java:58)
                 at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
                 at org.jboss.seam.debug.hot.HotDeployFilter.doFilter(HotDeployFilter.java:73)
                 at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
                 at org.jboss.seam.servlet.SeamFilter.doFilter(SeamFilter.java:158)
                 at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
                 at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
                 at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
                 at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
                 at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
                 at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:230)
                 at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)
                 at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:179)
                 at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:432)
                 at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:84)
                 at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
                 at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
                 at org.jboss.web.tomcat.service.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:157)
                 at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
                 at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:262)
                 at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)
                 at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583)
                 at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:446)
                 at java.lang.Thread.run(Unknown Source)
            






            • 3. Re: selectOneMenu on Search Screen
              scott duke Novice

              I probably need to add a few more things to the above. My Edition entity does have the properties for medium.



              public class Edition implements Serializable {
                  private Code medium;
              
              ... 
              
                   /**
                    * @return the medium
                    */
                  @ManyToOne
                  @JoinColumn(name = mediumId, referencedColumnName = "id", nullable = false)
                  @org.hibernate.annotations.ForeignKey(name = "fk_MediumCode_to_CodeId")
                   public Code getMedium() {
                        return medium;
                   }
              
                   /**
                    * @param medium the medium to set
                    */
                   public void setMedium(Code medium) {
                        this.medium = medium;
                   }
              
              ...
              
              }
              



              My EditionList.java looks like:



              @Name("editionList")
              public class EditionList extends EntityQuery<Edition>
              {
                   private static final long serialVersionUID = -311723806447384135L;
              
                   private static final String[] RESTRICTIONS = {
                        "edition.item.id = #{itemHome.itemId}",
                        "edition.limited = #{editionList.edition.limited}",
                        };
              
                   private Edition edition = new Edition();
              
                   @Override
                   public String getEjbql() {
                      return "select edition from Edition edition";
                   }
                   
                   @Override
                   public Integer getMaxResults() {
                        return 25;
                   }
              
                   public Edition getEdition() {
                        return edition;
                   }
              
                   @Override
                   public List<String> getRestrictions() {
                        return Arrays.asList(RESTRICTIONS);
                   }
                   
                   @Override
                   public String getOrder() {
                        if (super.getOrder() == null) {
                             setOrder("item.description asc");
                        }
                        return super.getOrder();
                   }   
                   
              }
              


              • 4. Re: selectOneMenu on Search Screen
                scott duke Novice

                I forgot in the above EditionList.java that I added the following:


                          "edition.medium = #{editionList.edition.medium}",
                
                



                And my EditionList.pages.xml looks like:



                <?xml version="1.0" encoding="UTF-8"?>
                <page xmlns="http://jboss.com/products/seam/pages"
                      xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
                      xsi:schemaLocation="http://jboss.com/products/seam/pages http://jboss.com/products/seam/pages-2.0.xsd">
                      
                   <param name="firstResult" value="#{editionList.firstResult}"/>
                   <param name="editionListOrder" value="#{editionList.order}"/>
                   <param name="from"/>
                   <param name="item" value="#{editionList.edition.item}"/>   
                   <param name="medium" value="#{editionList.edition.medium}"/> 
                   <param name="limited" value="#{editionList.edition.limited}"/> 
                
                </page>
                



                The error I am now getting is


                21:52:58,843 ERROR [SeamPhaseListener] uncaught exception
                javax.el.ELException: java.lang.IllegalArgumentException: argument type mismatch
                     at javax.el.BeanELResolver.setValue(BeanELResolver.java:116)
                     at javax.el.CompositeELResolver.setValue(CompositeELResolver.java:68)
                     at com.sun.faces.el.FacesCompositeELResolver.setValue(FacesCompositeELResolver.java:93)
                     at org.jboss.el.parser.AstPropertySuffix.setValue(AstPropertySuffix.java:73)
                     at org.jboss.el.parser.AstValue.setValue(AstValue.java:84)
                     at org.jboss.el.ValueExpressionImpl.setValue(ValueExpressionImpl.java:249)
                     at org.jboss.seam.core.Expressions$1.setValue(Expressions.java:117)
                     at org.jboss.seam.navigation.Pages.applyConvertedValidatedValuesToModel(Pages.java:784)
                     at org.jboss.seam.navigation.Pages.postRestore(Pages.java:411)
                     at org.jboss.seam.jsf.SeamPhaseListener.postRestorePage(SeamPhaseListener.java:546)
                     at org.jboss.seam.jsf.SeamPhaseListener.afterRestoreView(SeamPhaseListener.java:392)
                     at org.jboss.seam.jsf.SeamPhaseListener.afterServletPhase(SeamPhaseListener.java:228)
                     at org.jboss.seam.jsf.SeamPhaseListener.afterPhase(SeamPhaseListener.java:194)
                     at com.sun.faces.lifecycle.LifecycleImpl.phase(LifecycleImpl.java:280)
                     at com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:117)
                     at javax.faces.webapp.FacesServlet.service(FacesServlet.java:244)
                     at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
                     at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
                     at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:83)
                     at org.jboss.seam.web.MultipartFilter.doFilter(MultipartFilter.java:85)
                     at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
                     at org.jboss.seam.web.ExceptionFilter.doFilter(ExceptionFilter.java:64)
                     at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
                     at org.jboss.seam.web.RedirectFilter.doFilter(RedirectFilter.java:45)
                     at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
                     at org.ajax4jsf.webapp.BaseXMLFilter.doXmlFilter(BaseXMLFilter.java:154)
                     at org.ajax4jsf.webapp.BaseFilter.handleRequest(BaseFilter.java:260)
                     at org.ajax4jsf.webapp.BaseFilter.processUploadsAndHandleRequest(BaseFilter.java:366)
                     at org.ajax4jsf.webapp.BaseFilter.doFilter(BaseFilter.java:493)
                     at org.jboss.seam.web.Ajax4jsfFilter.doFilter(Ajax4jsfFilter.java:56)
                     at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
                     at org.jboss.seam.web.LoggingFilter.doFilter(LoggingFilter.java:58)
                     at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
                     at org.jboss.seam.debug.hot.HotDeployFilter.doFilter(HotDeployFilter.java:73)
                     at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
                     at org.jboss.seam.servlet.SeamFilter.doFilter(SeamFilter.java:158)
                     at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
                     at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
                     at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
                     at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
                     at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
                     at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:230)
                     at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)
                     at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:179)
                     at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:432)
                     at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:84)
                     at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
                     at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
                     at org.jboss.web.tomcat.service.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:157)
                     at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
                     at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:262)
                     at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)
                     at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583)
                     at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:446)
                     at java.lang.Thread.run(Unknown Source)
                Caused by: java.lang.IllegalArgumentException: argument type mismatch
                     at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
                     at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
                     at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
                     at java.lang.reflect.Method.invoke(Unknown Source)
                     at javax.el.BeanELResolver.setValue(BeanELResolver.java:108)
                     ... 54 more
                21:52:59,062 ERROR [CachedConnectionValve] Application error: Faces Servlet did not complete its transaction
                




                • 5. Re: selectOneMenu on Search Screen
                  Y E Newbie

                  Hi Scott,
                  did you manage to solve this problem and if yes can you provide some details?
                  Thanks.

                  • 6. Re: selectOneMenu on Search Screen
                    scott duke Novice

                    Sam, I believe I did resolve this issue. I will have to double check in a couple of days, because I went back and added itext, mail, lookup searching and a couple of more things to a basic setup, which I plan on updating to the rest of the code. I did look back at my last full save and this is what I did on my search screen.




                                 <s:decorate id="editionDecoration" template="layout/display.xhtml">
                                    <ui:define name="label">Edition</ui:define>               
                                      <h:selectOneMenu id="codeEdition"
                                                 styleClass="selectOneMenu"
                                                    value="#{editionList.edition.editionCode.id}">
                                           <s:selectItems value="#{codeList.editionCodes}" var="_codeEdition" label="#{_codeEdition.code}"
                                                             itemValue="#{_codeEdition.id}" noSelectionLabel=" "/>
                                      </h:selectOneMenu>
                                 </s:decorate>              
                                                      
                                 <s:decorate id="limitedDecoration" template="layout/display.xhtml">
                                    <ui:define name="label">Limited</ui:define>               
                                      <h:selectOneMenu id="limitedBooleanType"
                                                 styleClass="selectOneMenu"
                                                        value="#{editionList.edition.limited}">
                                           <s:selectItems value="#{codeList.booleanTypes}" var="_booleanType" label="#{_booleanType.value}" 
                                                             noSelectionLabel=" "/>
                                           <s:convertEnum />
                                      </h:selectOneMenu>
                                 </s:decorate>
                    
                    



                    If I remember correctly, this worked. I will update this once I test it again.

                    • 7. Re: selectOneMenu on Search Screen
                      scott duke Novice

                      Sam, I finally was able to get back to where I need in my code. I did look and test my editionList search. The code I added in my last reply does work.