2 Replies Latest reply on Oct 10, 2010 9:51 AM by Alex Saluk

    s:link includePageParams problem

    Alex Saluk Newbie

      I cannot solve the problem of suppressing page parameters in seam. I want to make two kind of searches through database: simple search using a keyword and an advanced search, which searches through various fields. Here is my advanced search form:




                  <s:decorate id="topicId" template="/layout/edit.xhtml">
                      <ui:define name="label">#{messages['searchcriteria.label.topic']}</ui:define>
                      <ice:selectOneMenu id="topic"
                                            value="#{advancedSearch.searchCriteria.topic}">
                           <s:selectItems var="_topic" value="#{topicList.resultList}"
                                          label="#{_topic.name}" noSelectionLabel=""
                                          itemValue="#{_topic.name}"/>
                      </ice:selectOneMenu>
                  </s:decorate>
      
                  <s:decorate id="countryId" template="/layout/edit.xhtml">
                      <ui:define name="label">#{messages['searchcriteria.label.country']}</ui:define>
                      <ice:selectOneMenu id="country"
                                            value="#{advancedSearch.searchCriteria.country}">
                           <s:selectItems var="_country" value="#{countryList.resultList}"
                                          label="#{_country.name}" noSelectionLabel=""
                                          itemValue="#{_country.name}"/>
                      </ice:selectOneMenu>
                  </s:decorate>
      
             </ice:panelGroup>
      
              <div class="actionButtons">
                  <ice:commandButton id="search" value="#{messages['label.search']}"
                                     action="search">
                  </ice:commandButton>
              </div>



        • 1. Re: s:link includePageParams problem
          Alex Saluk Newbie

          The simple search form:



              <ice:inputText value="#{advancedSearch.searchCriteria.keyword}"
                             styleClass="searchInput" size="70"/>
              <ice:commandButton id="search" value="#{messages['label.search']}"
                                 action="simpleSearch">
              </ice:commandButton>



          Page navigation rules:




              <page view-id="*">
                  <navigation>
                      <rule if-outcome="home">
                          <redirect view-id="/home.xhtml"/>
                      </rule>
                      <rule if-outcome="search">
                          <end-conversation />
                         <redirect view-id="/searchresult.xhtml" />
                      </rule>
                      <rule if-outcome="simpleSearch">
                          <end-conversation />
                         <redirect view-id="/simplesearchresult.xhtml"/>
                      </rule>
                  </navigation>
              </page>



          Page parameters from /searchresult.xhtml:




                <begin-conversation join="true" flush-mode="MANUAL"/>
                <action execute="#{advancedSearch.makeSearch}"/>
          
             <param name="title" value="#{advancedSearch.searchCriteria.title}"/>
             <param name="country" value="#{advancedSearch.searchCriteria.country}" />
             <param name="q" value="#{advancedSearch.searchCriteria.keyword}" />
          


          Page parameters from /simplesearchresult.xhtml:




          <begin-conversation join="true" flush-mode="MANUAL"/>
                <action execute="#{advancedSearch.makeSimpleSearch}" />
          
             <param name="q" value="#{advancedSearch.searchCriteria.keyword}" />




          When I first make an advanced search using country field I land on /searchresult.xhtml with country parameter equal to provided in the form. Then from this page I make a simple search and land on the /simplesearchresult.xhtml with no country parameter as expected. However, both pages include the following facet search link, which should narrow the search:




          <ui:repeat value="#{advancedSearch.getpTopicFacets()}" var="_facet">
               <s:link view="/searchresult.xhtml" includePageParams="false">
                   <ice:outputText value="#{_facet.value} (#{_facet.hitCount})"/>
                   <f:param name="refine" value="true" />
                   <f:param name="addTopic" value="#{_facet.value}" />
          
                  <f:param name="country" value="#{advancedSearch.searchCriteria.country}" />
              </s:link>
              #{" "}
          </ui:repeat>



          In either case the link include the country parameter set to the value provided from the advanced search form. Though I expect that after simple search the country should resolve to null. I have tried to explicitly make the country null in the simple search action, but it didn't help. The tracing for the setter method for country also shows that the value is null:



           setting country, old value: null, new value: null



          But the parameter in the s:link remains set to initially provided value. Can somebody help me with this issue. Thank you.

          • 2. Re: s:link includePageParams problem
            Alex Saluk Newbie

            The problem was solved by adding


            before-redirect="true"



            to


            end-conversation



            in page navigation rules