2 Replies Latest reply on Apr 22, 2008 3:59 PM by José Moreira

    url GET param gets propagated in links for the same viewid

    José Moreira Newbie

      this may sound stupid but .... i have a catalog browser page that receives a param, catid and lists sub-categories of that category (adjacency list) with links for the same viewid and that allows to traverse the category tree.


      the problem is that the catid gets appended to links for the same viewid, meaning that there's a link to the catalog root in the main menu that gets appended with the current id, not allowing the user to get back to the main categories.


      pages.xml


      <page view-id="/browse.xhtml" login-required="false">
          <param name="catid" converterId="javax.faces.Long" value="#{itemBrowser.catId}"/>
      </page>
      



      main menu link


      <s:link view="/browse.xhtml" propagation="none">Browse</s:link>
      



      categories data table


          <rich:dataList var="cat" value="#{categoryList}" rendered="#{!empty categoryList}">
           <s:link view="/browse.xhtml" value="#{cat.name}" propagation="none">
               <f:param name="catid" value="#{cat.id}" />
           </s:link>
          </rich:dataList>
      
      



      the component


      /*
       * $Id$
       */
      package com.iwantmystuffback.web.actions;
      
      import java.util.List;
      
      
      import org.jboss.seam.ScopeType;
      import org.jboss.seam.annotations.Factory;
      import org.jboss.seam.annotations.In;
      import org.jboss.seam.annotations.Name;
      import org.jboss.seam.annotations.Scope;
      import org.jboss.seam.annotations.datamodel.DataModel;
      
      import com.iwantmystuffback.web.dao.CategoryDAO;
      import com.iwantmystuffback.web.model.trading.Category;
      
      /**
       * 
       * @author josemoreira
       *
       */
      // TODO @Stateless ?
      @Name("itemBrowser")
      @Scope(ScopeType.PAGE)
      public class ItemBrowser {
      
           /**
            * 
            */
           @In
           CategoryDAO categoryDAO;
           @DataModel(scope = ScopeType.PAGE)
           private List<Category> categoryList;
           private Long catId;
      
           @Factory(value = "categoryList")
           public void initList() {
                if (getCatId() == null) {
                     categoryList = categoryDAO.getRootCategories();
                } else {
                     categoryList = categoryDAO.findCategoriesByParent(getCatId());
                }
           }
      
           /**
            * @return the categoryList
            */
           public List<Category> getCategoryList() {
                return categoryList;
           }
      
           /**
            * @param categoryList the categoryList to set
            */
           public void setCategoryList(List<Category> categoryBrowseList) {
                this.categoryList = categoryBrowseList;
           }
      
           /**
            * @return the catId
            */
           
           public Long getCatId() {
                return catId;
           }
      
           /**
            * @param catId the catId to set
            */
           public void setCatId(Long catId) {
                this.catId = catId;
           }
      }
      
      



      what should i do?