4 Replies Latest reply on Jun 29, 2011 4:54 PM by Sean Jensen

    searching using selectOneListbox

    Sean Jensen Newbie

      I'm trying to modify the search panel on one of my pages using Seam 2.2.1.Final with jboss 5.1.0.GA.  I've copied the generated page so that I can derive functionality without rewriting everything.  I've changed the inputtext box in my search panel to a selectOneListbox and would like to use the selected value in my search.  However I'm getting an error that says:

      'regionIdcode' parameter is invalid: Target Unreachable, 'region' returned null on 'org.domain.fair.entity.InvOrgCode'

      My OrgCodeList.page.xml file code looks like this:

         <param name="from"/>
         <param name="regionIdcode" value="#{invOrgCodeList.invOrgCode.region.regionId}"/>
         <param name="orgCode" value="#{invOrgCodeList.invOrgCode.orgCode}"/>
         <param name="title" value="#{invOrgCodeList.invOrgCode.title}"/>

      My OrgCodeList.xhtml file looks like this:

      <s:decorate template="layout/display.xhtml">
              <ui:define name="label">Region:</ui:define>
           <h:selectOneListbox style="color:black"
                   value="#{invOrgCodeList.invOrgCode.region}" size="1">
                <s:selectItems value="#{regionList.resultList}"
                     itemValue="#{region}" var="region" label="#{region.code}"
                     noSelectionLabel="Select One" />
                <s:convertEntity />

      My InvOrgCode.java class has these declared with all the appropriate getters and setters.

           private BigDecimal invOrgCodeId;
           private Region region;
           private String fiscalYear;
           private String orgCode;
           private String title;
           private Set<FairUser> fairUsers = new HashSet<FairUser>(0);
           private Set<InvPosition> invPositions = new HashSet<InvPosition>(0);

      I'm learning so I don't mind a bit of research but I'm also under a deadline so I need a practical solution as soon as I can work it out.


        • 1. Re: searching using selectOneListbox
          omid pourhadi Apprentice


          Add This to your components.xml

          <component class="Region" name="region" />
          <component class="InvOrgCode" name="invOrgCode">
               <property name="region">#{region}</property>

          • 2. Re: searching using selectOneListbox
            Sean Jensen Newbie

            Thank you for replying.

            I've added those to my components.xml and am getting error messages saying that they cannot be resolved to a type.

            What would be the purpose of defining these here?  Any suggestion on how I can eliminate the error messages?

            • 3. Re: searching using selectOneListbox
              omid pourhadi Apprentice

              By defining these 2 lines you tell Seam, create a component instance of each Entity and bind it to property of your class which is region , then target is reachable
              i guess it's because invOrgCodeList, would you please show the source code of invOrgCodeList

              Do you have this method in invOrgCodeList ?

              InvOrgCode invOrgCode = new InvOrgCode();
              public InvOrgCode getInvOrgCode(){
                  return invOrgCode;

              PS : pay attention to naming convention


              • 4. Re: searching using selectOneListbox
                Sean Jensen Newbie

                I have those methods in my inOrgCodeList.java class as you can see.

                public class InvOrgCodeList extends EntityQuery<InvOrgCode> {
                     private static final String EJBQL = "select invOrgCode from InvOrgCode invOrgCode";
                     private static final String[] RESTRICTIONS = {
                               "lower(invOrgCode.region.code) like lower(concat(#{invOrgCodeList.invOrgCode.region.code},'%'))",
                               "lower(invOrgCode.orgCode) like lower(concat(#{invOrgCodeList.invOrgCode.orgCode},'%'))",
                               "lower(invOrgCode.title) like lower(concat(#{invOrgCodeList.invOrgCode.title},'%'))", };
                     private InvOrgCode invOrgCode = new InvOrgCode();
                     public InvOrgCodeList() {
                     public InvOrgCode getInvOrgCode() {
                          return invOrgCode;

                I resolved my error (thank you for the hint) and tried this.  Although I didn't get any errors I didn't get filtered results either.  I'm sure someone has done this successfully but I have no idea where to see an example.  Does anyone have an example of a search done with a drop down instead of an inputText?