1 Reply Latest reply on Apr 3, 2007 1:26 PM by hispeedsurfer

    Need help

    hispeedsurfer

      Hi,

      I hope someone can help me.
      I have a search field to reduce a table result similar like in booking example.
      This search field is placed on a template based site.
      But only the first site how share this template uses the search field in right way.

      template.xhtml

      <ui:composition xmlns="http://www.w3.org/1999/xhtml"
       xmlns:ui="http://java.sun.com/jsf/facelets"
       xmlns:h="http://java.sun.com/jsf/html"
       xmlns:f="http://java.sun.com/jsf/core"
       xmlns:s="http://jboss.com/products/seam/taglib"
       xmlns:a="https://ajax4jsf.dev.java.net/ajax"
       xmlns:rich="http://richfaces.ajax4jsf.org/rich"
       xmlns:t="http://myfaces.apache.org/tomahawk"
       xmlns:sb="http://myfaces.apache.org/sandbox">
       <div id="content">
       <h:form id="searchform">
      
       <span class="errors">
       <h:messages globalOnly="true"/>
       </span>
      
      
       <fieldset>
       <a:region id="searchRegion" renderRegionOnly="false">
       <h:inputText id="searchString" value="#{searchboxlist.searchString}" style="width: 165px;">
       <a:support event="onkeyup" actionListener="#{searchboxlist.find}" reRender="searchResults, lowerform" requestDelay="1" />
       </h:inputText>
       <sb:focus id="focus" for="searchString"/>
       </a:region><!-- End searchRegion -->
      
      
       <a:status for="searchRegion">
       <f:facet name="start">
       <h:graphicImage value="/img/spinner.gif"/>
       </f:facet>
       </a:status>
       </fieldset>
      
       </h:form><!-- End searchform -->
      
      
       <ui:insert name="values" />
       </div><!-- End content -->
      </ui:composition>
      

      searchboxlist holding the currend business bean (<ui:param name="searchboxlist" value="#{userlist}" />)

      This template is used from several inner pages that are included with <ui:include src="#{currentSite}"/>

      one of this inner site is like this one
      userlist.xhtml (in this case currentSite contain userlist.xhtml)
      <ui:composition xmlns="http://www.w3.org/1999/xhtml"
       xmlns:ui="http://java.sun.com/jsf/facelets"
       xmlns:h="http://java.sun.com/jsf/html"
       xmlns:f="http://java.sun.com/jsf/core"
       xmlns:s="http://jboss.com/products/seam/taglib"
       xmlns:a="https://ajax4jsf.dev.java.net/ajax"
       xmlns:rich="http://richfaces.ajax4jsf.org/rich"
       xmlns:t="http://myfaces.apache.org/tomahawk"
       template="/skeleton-list.xhtml">
      
       <ui:param name="searchboxlist" value="#{userlist}" />
      
       <ui:define name="values">
       <div id="uppercontent">
       <a:outputPanel id="searchResults">
       <a:form id="upperform">
       <rich:dataTable
       onRowMouseOver="this.style.backgroundColor='#F1F1F1'"
       onRowMouseOut="this.style.backgroundColor='#{a4jSkin.tableBackgroundColor}'"
       cellpadding="0" cellspacing="0" width="840" border="0" var="user"
       columnsWidth="205" value="#{usertablelist}">
      
       <f:facet name="header">
       <rich:columnGroup>
       <rich:column>
       <h:outputText value="erste"></h:outputText>
       </rich:column>
       <rich:column>
       <h:outputText value="zweite"></h:outputText>
       </rich:column>
       <rich:column>
       <h:outputText value="dritte"></h:outputText>
       </rich:column>
       <rich:column>
       <h:outputText value="vierte"></h:outputText>
       </rich:column>
       </rich:columnGroup>
       </f:facet>
      
       <rich:column>
       <h:outputText value="#{user.username}"></h:outputText>
       </rich:column>
       <rich:column>
       <h:outputText value="#{user.forename}"></h:outputText>
       </rich:column>
       <rich:column>
       <h:outputText value="#{user.surname}"></h:outputText>
       </rich:column>
       <rich:column>
       <h:outputText value="#{user.email}"></h:outputText>
       </rich:column>
       <a:support id="support1" event="onRowClick" reRender="lowerform" />
       </rich:dataTable>
       </a:form>
       <!-- End upperform -->
       </a:outputPanel><!-- End searchresults --></div>
       <!-- End uppercontent -->
      
       </ui:define>
      
      </ui:composition>
      
      


      Table refresh and search field works fine.

      When I switch to an other inner page like admins.xhtml the same template with search field is used and currentSite is set to admins.xhtml and the ui:include is Ajax rerendered. (works)
      But when I enter some character in search field to reduce the table result first the (previous) userlist.find is called an contains the searching word and second adminlist.find is called but the field (searchString) is null.

      Why UserlistBean.find is called because in admins.xhtml the correct param is set and adminlist.find should be called?!!!
      <ui:param name="searchboxlist" value="#{adminlist}" />
      



      Any idea what I have to correct get this working?


      Thanks
      Andi

        • 1. Template not working properly
          hispeedsurfer

          Hey, no idea whats wrong.

          why userlist.find is called when I pass adminlist to template?
          Normally only adminlist.find should be called.

          I see that the right page (admins.xhtml) is displayed but userlist in template is called.



          thanks