You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@myfaces.apache.org by Gregg Bolinger <gd...@gmail.com> on 2006/06/22 18:25:58 UTC

commandLink not working: FaceTrace

I have a page where the commandLink isn't triggering the associated
actionListener.  The link on the page is identical to the link on another
similar page.  They are just using different managed beans.


<t:dataTable var="category"
                    binding="#{SubCategoryAdminBean.categoryData}"
                    value="#{SubCategoryAdminBean.categories}">
                    <t:column>
                        <t:commandLink id="editCatLink"
                            actionListener="#{
SubCategoryAdminBean.editCategory}">
                            <t:outputText value="#{category.categoryName}"
/>
                            <t:updateActionListener
                                property="#{
SubCategoryAdminBean.currentCategory}"
                                value="#{category}" />
                        </t:commandLink>
                    </t:column>
                </t:dataTable>


I started using FacesTrace to see if I could see any useful information.
And what I've discovered is that when processing the page that works I get
the following key/value:

categoryAdminForm:_link_hidden_       --
categoryAdminForm:_idJsp15:1:_idJsp18

However, when I click the link on the page that doesn't work I get

categoryAdminForm:_link_hidden_       --

No value.  Problem is, I have no clue what that tells me.  Anyone?

Thanks.

Re: commandLink not working: FaceTrace

Posted by Gregg Bolinger <gd...@gmail.com>.
I added preserveDataModel="true" to my dataTable and it seems to be working
for now.

Gregg

On 6/23/06, Gregg Bolinger <gd...@gmail.com> wrote:
>
> Has anyone had a chance to look at this by any chance?  I still cannot
> find a way to resolve this.
>
> Thanks.
>
> Gregg
>
>
> On 6/22/06, Gregg Bolinger <gd...@gmail.com> wrote:
> >
> > I think I might know what is going on.  It just hit me.  When the page
> > is first loaded, the dataTable is empty.  I populate it after I select a
> > category from the dropdown and click the ok button.
> >
> > Now, how do I resolve that if that is truly the case?
> >
> >
> > On 6/22/06, Gregg Bolinger < gdboling.myfaces@gmail.com> wrote:
> > >
> > > To add another piece to the puzzle, I placed a commandLink with a
> > > different ID and the same actionListener outside othe dataTable, and it
> > > triggers the actionListener method just fine.
> > >
> > > Thanks.
> > >
> > >
> > > On 6/22/06, Gregg Bolinger <gd...@gmail.com> wrote:
> > > >
> > > > Let me deliver this problem a bit differently.  I apologize in
> > > > advance for the long bit of code I am about to post.  I've stripped the page
> > > > of everything except what is causing the problem and also stripped down the
> > > > managed bean to just support the page.
> > > >
> > > > The commandLinks arren't triggering the actionListener.  I am hoping
> > > > a fresh set of eyes will be able to clue me in to why.  Hopefully it is
> > > > something simple.  Putting the managed bean in session scope allows
> > > > everything to work.  But when in request scope, it doesn't work.
> > > >
> > > > JDK1.4
> > > > Tomcat 5.0.28
> > > > MyFaces 1.1.3
> > > > Tomahawk 1.1.2
> > > >
> > > > <%@ taglib uri="http://java.sun.com/jsf/html " prefix="h"%>
> > > > <%@ taglib uri=" http://java.sun.com/jsf/core" prefix="f"%>
> > > > <%@ taglib uri=" http://myfaces.apache.org/tomahawk" prefix="t"%>
> > > > <%@ taglib uri="http://sourceforge.net/projects/facestrace"
> > > > prefix="ft"%>
> > > > <f:loadBundle basename="MessageResources" var="bundle" />
> > > > <f:view>
> > > >     <html>
> > > >     <head>
> > > >     <title>Sub Category Admin</title>
> > > >     </head>
> > > >
> > > >     <body>
> > > >     <f:subview id="header">
> > > >         <jsp:include page=" Header.jsp" />
> > > >     </f:subview>
> > > >     <t:messages />
> > > >     <h:form id="subCategoryAdminForm">
> > > >     <t:saveState value="#{SubCategoryAdminBean.currentCategory}"/>
> > > >         <t:panelGrid columns="2" cellpadding="0" cellspacing="0">
> > > >             <t:panelGrid columns="1">
> > > >                 <f:facet name="header">
> > > >                     <t:outputText value="Sub Category List" />
> > > >                 </f:facet>
> > > >                 <t:panelGrid columns="2">
> > > >                     <t:outputText value="Filter" />
> > > >                     <t:panelGroup />
> > > >
> > > >                     <t:outputText value="Category" />
> > > >                     <t:selectOneMenu
> > > >                         binding="#{
> > > > SubCategoryAdminBean.parentCategoriesSelectOneMenu }"
> > > >                         value="#{
> > > > SubCategoryAdminBean.parentCategory.categoryId}" />
> > > >
> > > >                     <t:panelGroup />
> > > >                     <t:commandButton value="OK" />
> > > >                 </t:panelGrid>
> > > >
> > > >                 <t:dataTable var="category"
> > > >                     binding="#{SubCategoryAdminBean.categoryData}"
> > > >                     value="#{ SubCategoryAdminBean.categories }">
> > > >                     <t:column>
> > > >                         <t:commandLink id="editCatLink"
> > > >                             actionListener="#{
> > > > SubCategoryAdminBean.editCategory}">
> > > >                             <t:outputText value="#{
> > > > category.categoryName}" />
> > > >                             <t:updateActionListener
> > > >                                 property="#{
> > > > SubCategoryAdminBean.currentCategory }"
> > > >                                 value="#{category}" />
> > > >                         </t:commandLink>
> > > >                     </t:column>
> > > >                 </t:dataTable>
> > > >             </t:panelGrid>
> > > >             <t:panelGrid columns="1">
> > > >                 <t:inputText
> > > >                     value="#{
> > > > SubCategoryAdminBean.currentCategory.categoryName}" />
> > > >             </t:panelGrid>
> > > >         </t:panelGrid>
> > > >     </h:form>
> > > >     <ft:trace showTree="true" />
> > > >     </body>
> > > >     </html>
> > > > </f:view>
> > > >
> > > > public class SubCategoryAdminBean extends BaseBean
> > > > {
> > > >     private Category currentCategory;
> > > >     private Category parentCategory;
> > > >     private CategoryService categoryService;
> > > >     private UIData categoryData;
> > > >     private KeywordService keywordService;
> > > >     private String parentCatId;
> > > >     private HtmlSelectOneMenu parentCategoriesSelectOneMenu;
> > > >
> > > >     public void setKeywordService(KeywordService keywordService)
> > > >     {
> > > >         this.keywordService = keywordService;
> > > >     }
> > > >
> > > >     public UIData getCategoryData()
> > > >     {
> > > >         return categoryData;
> > > >     }
> > > >
> > > >     public void setCategoryData(UIData categoryData)
> > > >     {
> > > >         this.categoryData = categoryData;
> > > >     }
> > > >
> > > >     public Category getCurrentCategory()
> > > >     {
> > > >         return currentCategory;
> > > >     }
> > > >
> > > >     public void setCurrentCategory(Category currentCategory)
> > > >     {
> > > >         this.currentCategory = currentCategory;
> > > >     }
> > > >
> > > >     public CategoryService getCategoryService()
> > > >     {
> > > >         return categoryService;
> > > >     }
> > > >
> > > >     public void setCategoryService(CategoryService categoryService)
> > > >     {
> > > >         this.categoryService = categoryService;
> > > >     }
> > > >
> > > >     public boolean isEditing()
> > > >     {
> > > >         if (currentCategory.getCategoryId() != null)
> > > >         {
> > > >             return true;
> > > >         }
> > > >         else
> > > >         {
> > > >             return false;
> > > >         }
> > > >     }
> > > >
> > > >     public List getCategories()
> > > >     {
> > > >         if (parentCategory.getCategoryId() == null)
> > > >         {
> > > >             return null;
> > > >         }
> > > >         return categoryService.getCategories(
> > > > parentCategory.getCategoryId(),
> > > >                 null, null);
> > > >     }
> > > >
> > > >     public String getParentCatId()
> > > >     {
> > > >         return parentCatId;
> > > >     }
> > > >
> > > >     public void setParentCatId(String parentCatId)
> > > >     {
> > > >         this.parentCatId = parentCatId;
> > > >     }
> > > >
> > > >     public Category getParentCategory()
> > > >     {
> > > >         return parentCategory;
> > > >     }
> > > >
> > > >     public void setParentCategory(Category parentCategory)
> > > >     {
> > > >         this.parentCategory = parentCategory;
> > > >     }
> > > >
> > > >     public HtmlSelectOneMenu getParentCategoriesSelectOneMenu()
> > > >     {
> > > >         if (parentCategoriesSelectOneMenu == null)
> > > >         {
> > > >             parentCategoriesSelectOneMenu = new HtmlSelectOneMenu();
> > > >
> > > >         }
> > > >         final List list = new ArrayList();
> > > >         List categoryList = categoryService.getCategories(null,
> > > > null, null);
> > > >         Iterator iter = categoryList.iterator();
> > > >         while(iter.hasNext ())
> > > >         {
> > > >             Category category = (Category)iter.next();
> > > >             list.add(new SelectItem(category.getCategoryId().toString(),
> > > > category.getCategoryName()));
> > > >
> > > >         }
> > > >         final UISelectItems items = new UISelectItems();
> > > >         items.setValue(list);
> > > >         parentCategoriesSelectOneMenu.getChildren().add(items);
> > > >         return parentCategoriesSelectOneMenu;
> > > >     }
> > > >
> > > >     public void setParentCategoriesSelectOneMenu(
> > > >             HtmlSelectOneMenu parentCategoriesSelectOneMenu)
> > > >     {
> > > >         this.parentCategoriesSelectOneMenu =
> > > > parentCategoriesSelectOneMenu;
> > > >     }
> > > >
> > > >
> > > >     public void editCategory(ActionEvent event)
> > > >     {
> > > >         System.out.println(currentCategory.getCategoryName ());
> > > >         System.out.println(parentCategory.getCategoryName());
> > > >
> > > >     }
> > > > }
> > > >
> > > >
> > > > On 6/22/06, Gregg Bolinger < gdboling.myfaces@gmail.com> wrote:
> > > > >
> > > > > I have a page where the commandLink isn't triggering the
> > > > > associated actionListener.  The link on the page is identical to the link on
> > > > > another similar page.  They are just using different managed beans.
> > > > >
> > > > >
> > > > > <t:dataTable var="category"
> > > > >                     binding="#{SubCategoryAdminBean.categoryData}"
> > > > >                     value="#{SubCategoryAdminBean.categories}">
> > > > >                     <t:column>
> > > > >                         <t:commandLink id="editCatLink"
> > > > >                             actionListener="#{
> > > > > SubCategoryAdminBean.editCategory}">
> > > > >                             <t:outputText value="#{
> > > > > category.categoryName}" />
> > > > >                             <t:updateActionListener
> > > > >                                 property="#{
> > > > > SubCategoryAdminBean.currentCategory}"
> > > > >                                 value="#{category}" />
> > > > >                         </t:commandLink>
> > > > >                     </t:column>
> > > > >                 </t:dataTable>
> > > > >
> > > > >
> > > > > I started using FacesTrace to see if I could see any useful
> > > > > information.  And what I've discovered is that when processing the page that
> > > > > works I get the following key/value:
> > > > >
> > > > > categoryAdminForm:_link_hidden_       --
> > > > > categoryAdminForm:_idJsp15:1:_idJsp18
> > > > >
> > > > > However, when I click the link on the page that doesn't work I get
> > > > >
> > > > >
> > > > > categoryAdminForm:_link_hidden_       --
> > > > >
> > > > > No value.  Problem is, I have no clue what that tells me.  Anyone?
> > > > >
> > > > > Thanks.
> > > > >
> > > >
> > > >
> > >
> >
>

Re: commandLink not working: FaceTrace

Posted by Gregg Bolinger <gd...@gmail.com>.
Has anyone had a chance to look at this by any chance?  I still cannot find
a way to resolve this.

Thanks.

Gregg

On 6/22/06, Gregg Bolinger <gd...@gmail.com> wrote:
>
> I think I might know what is going on.  It just hit me.  When the page is
> first loaded, the dataTable is empty.  I populate it after I select a
> category from the dropdown and click the ok button.
>
> Now, how do I resolve that if that is truly the case?
>
>
> On 6/22/06, Gregg Bolinger <gd...@gmail.com> wrote:
> >
> > To add another piece to the puzzle, I placed a commandLink with a
> > different ID and the same actionListener outside othe dataTable, and it
> > triggers the actionListener method just fine.
> >
> > Thanks.
> >
> >
> > On 6/22/06, Gregg Bolinger <gd...@gmail.com> wrote:
> > >
> > > Let me deliver this problem a bit differently.  I apologize in advance
> > > for the long bit of code I am about to post.  I've stripped the page of
> > > everything except what is causing the problem and also stripped down the
> > > managed bean to just support the page.
> > >
> > > The commandLinks arren't triggering the actionListener.  I am hoping a
> > > fresh set of eyes will be able to clue me in to why.  Hopefully it is
> > > something simple.  Putting the managed bean in session scope allows
> > > everything to work.  But when in request scope, it doesn't work.
> > >
> > > JDK1.4
> > > Tomcat 5.0.28
> > > MyFaces 1.1.3
> > > Tomahawk 1.1.2
> > >
> > > <%@ taglib uri="http://java.sun.com/jsf/html " prefix="h"%>
> > > <%@ taglib uri=" http://java.sun.com/jsf/core" prefix="f"%>
> > > <%@ taglib uri=" http://myfaces.apache.org/tomahawk" prefix="t"%>
> > > <%@ taglib uri="http://sourceforge.net/projects/facestrace"
> > > prefix="ft"%>
> > > <f:loadBundle basename="MessageResources" var="bundle" />
> > > <f:view>
> > >     <html>
> > >     <head>
> > >     <title>Sub Category Admin</title>
> > >     </head>
> > >
> > >     <body>
> > >     <f:subview id="header">
> > >         <jsp:include page=" Header.jsp" />
> > >     </f:subview>
> > >     <t:messages />
> > >     <h:form id="subCategoryAdminForm">
> > >     <t:saveState value="#{SubCategoryAdminBean.currentCategory}"/>
> > >         <t:panelGrid columns="2" cellpadding="0" cellspacing="0">
> > >             <t:panelGrid columns="1">
> > >                 <f:facet name="header">
> > >                     <t:outputText value="Sub Category List" />
> > >                 </f:facet>
> > >                 <t:panelGrid columns="2">
> > >                     <t:outputText value="Filter" />
> > >                     <t:panelGroup />
> > >
> > >                     <t:outputText value="Category" />
> > >                     <t:selectOneMenu
> > >                         binding="#{
> > > SubCategoryAdminBean.parentCategoriesSelectOneMenu }"
> > >                         value="#{
> > > SubCategoryAdminBean.parentCategory.categoryId}" />
> > >
> > >                     <t:panelGroup />
> > >                     <t:commandButton value="OK" />
> > >                 </t:panelGrid>
> > >
> > >                 <t:dataTable var="category"
> > >                     binding="#{SubCategoryAdminBean.categoryData}"
> > >                     value="#{ SubCategoryAdminBean.categories }">
> > >                     <t:column>
> > >                         <t:commandLink id="editCatLink"
> > >                             actionListener="#{
> > > SubCategoryAdminBean.editCategory}">
> > >                             <t:outputText value="#{
> > > category.categoryName}" />
> > >                             <t:updateActionListener
> > >                                 property="#{
> > > SubCategoryAdminBean.currentCategory }"
> > >                                 value="#{category}" />
> > >                         </t:commandLink>
> > >                     </t:column>
> > >                 </t:dataTable>
> > >             </t:panelGrid>
> > >             <t:panelGrid columns="1">
> > >                 <t:inputText
> > >                     value="#{
> > > SubCategoryAdminBean.currentCategory.categoryName}" />
> > >             </t:panelGrid>
> > >         </t:panelGrid>
> > >     </h:form>
> > >     <ft:trace showTree="true" />
> > >     </body>
> > >     </html>
> > > </f:view>
> > >
> > > public class SubCategoryAdminBean extends BaseBean
> > > {
> > >     private Category currentCategory;
> > >     private Category parentCategory;
> > >     private CategoryService categoryService;
> > >     private UIData categoryData;
> > >     private KeywordService keywordService;
> > >     private String parentCatId;
> > >     private HtmlSelectOneMenu parentCategoriesSelectOneMenu;
> > >
> > >     public void setKeywordService(KeywordService keywordService)
> > >     {
> > >         this.keywordService = keywordService;
> > >     }
> > >
> > >     public UIData getCategoryData()
> > >     {
> > >         return categoryData;
> > >     }
> > >
> > >     public void setCategoryData(UIData categoryData)
> > >     {
> > >         this.categoryData = categoryData;
> > >     }
> > >
> > >     public Category getCurrentCategory()
> > >     {
> > >         return currentCategory;
> > >     }
> > >
> > >     public void setCurrentCategory(Category currentCategory)
> > >     {
> > >         this.currentCategory = currentCategory;
> > >     }
> > >
> > >     public CategoryService getCategoryService()
> > >     {
> > >         return categoryService;
> > >     }
> > >
> > >     public void setCategoryService(CategoryService categoryService)
> > >     {
> > >         this.categoryService = categoryService;
> > >     }
> > >
> > >     public boolean isEditing()
> > >     {
> > >         if (currentCategory.getCategoryId() != null)
> > >         {
> > >             return true;
> > >         }
> > >         else
> > >         {
> > >             return false;
> > >         }
> > >     }
> > >
> > >     public List getCategories()
> > >     {
> > >         if (parentCategory.getCategoryId() == null)
> > >         {
> > >             return null;
> > >         }
> > >         return categoryService.getCategories(
> > > parentCategory.getCategoryId(),
> > >                 null, null);
> > >     }
> > >
> > >     public String getParentCatId()
> > >     {
> > >         return parentCatId;
> > >     }
> > >
> > >     public void setParentCatId(String parentCatId)
> > >     {
> > >         this.parentCatId = parentCatId;
> > >     }
> > >
> > >     public Category getParentCategory()
> > >     {
> > >         return parentCategory;
> > >     }
> > >
> > >     public void setParentCategory(Category parentCategory)
> > >     {
> > >         this.parentCategory = parentCategory;
> > >     }
> > >
> > >     public HtmlSelectOneMenu getParentCategoriesSelectOneMenu()
> > >     {
> > >         if (parentCategoriesSelectOneMenu == null)
> > >         {
> > >             parentCategoriesSelectOneMenu = new HtmlSelectOneMenu();
> > >         }
> > >         final List list = new ArrayList();
> > >         List categoryList = categoryService.getCategories(null, null,
> > > null);
> > >         Iterator iter = categoryList.iterator();
> > >         while(iter.hasNext ())
> > >         {
> > >             Category category = (Category)iter.next();
> > >             list.add(new SelectItem(category.getCategoryId().toString(),
> > > category.getCategoryName()));
> > >
> > >         }
> > >         final UISelectItems items = new UISelectItems();
> > >         items.setValue(list);
> > >         parentCategoriesSelectOneMenu.getChildren().add(items);
> > >         return parentCategoriesSelectOneMenu;
> > >     }
> > >
> > >     public void setParentCategoriesSelectOneMenu(
> > >             HtmlSelectOneMenu parentCategoriesSelectOneMenu)
> > >     {
> > >         this.parentCategoriesSelectOneMenu =
> > > parentCategoriesSelectOneMenu;
> > >     }
> > >
> > >
> > >     public void editCategory(ActionEvent event)
> > >     {
> > >         System.out.println(currentCategory.getCategoryName ());
> > >         System.out.println(parentCategory.getCategoryName());
> > >
> > >     }
> > > }
> > >
> > >
> > > On 6/22/06, Gregg Bolinger < gdboling.myfaces@gmail.com> wrote:
> > > >
> > > > I have a page where the commandLink isn't triggering the associated
> > > > actionListener.  The link on the page is identical to the link on another
> > > > similar page.  They are just using different managed beans.
> > > >
> > > >
> > > > <t:dataTable var="category"
> > > >                     binding="#{SubCategoryAdminBean.categoryData}"
> > > >                     value="#{SubCategoryAdminBean.categories}">
> > > >                     <t:column>
> > > >                         <t:commandLink id="editCatLink"
> > > >                             actionListener="#{
> > > > SubCategoryAdminBean.editCategory}">
> > > >                             <t:outputText value="#{
> > > > category.categoryName}" />
> > > >                             <t:updateActionListener
> > > >                                 property="#{
> > > > SubCategoryAdminBean.currentCategory}"
> > > >                                 value="#{category}" />
> > > >                         </t:commandLink>
> > > >                     </t:column>
> > > >                 </t:dataTable>
> > > >
> > > >
> > > > I started using FacesTrace to see if I could see any useful
> > > > information.  And what I've discovered is that when processing the page that
> > > > works I get the following key/value:
> > > >
> > > > categoryAdminForm:_link_hidden_       --
> > > > categoryAdminForm:_idJsp15:1:_idJsp18
> > > >
> > > > However, when I click the link on the page that doesn't work I get
> > > >
> > > > categoryAdminForm:_link_hidden_       --
> > > >
> > > > No value.  Problem is, I have no clue what that tells me.  Anyone?
> > > >
> > > > Thanks.
> > > >
> > >
> > >
> >
>

Re: commandLink not working: FaceTrace

Posted by Gregg Bolinger <gd...@gmail.com>.
I think I might know what is going on.  It just hit me.  When the page is
first loaded, the dataTable is empty.  I populate it after I select a
category from the dropdown and click the ok button.

Now, how do I resolve that if that is truly the case?

On 6/22/06, Gregg Bolinger <gd...@gmail.com> wrote:
>
> To add another piece to the puzzle, I placed a commandLink with a
> different ID and the same actionListener outside othe dataTable, and it
> triggers the actionListener method just fine.
>
> Thanks.
>
>
> On 6/22/06, Gregg Bolinger <gd...@gmail.com> wrote:
> >
> > Let me deliver this problem a bit differently.  I apologize in advance
> > for the long bit of code I am about to post.  I've stripped the page of
> > everything except what is causing the problem and also stripped down the
> > managed bean to just support the page.
> >
> > The commandLinks arren't triggering the actionListener.  I am hoping a
> > fresh set of eyes will be able to clue me in to why.  Hopefully it is
> > something simple.  Putting the managed bean in session scope allows
> > everything to work.  But when in request scope, it doesn't work.
> >
> > JDK1.4
> > Tomcat 5.0.28
> > MyFaces 1.1.3
> > Tomahawk 1.1.2
> >
> > <%@ taglib uri="http://java.sun.com/jsf/html " prefix="h"%>
> > <%@ taglib uri=" http://java.sun.com/jsf/core" prefix="f"%>
> > <%@ taglib uri=" http://myfaces.apache.org/tomahawk" prefix="t"%>
> > <%@ taglib uri="http://sourceforge.net/projects/facestrace"
> > prefix="ft"%>
> > <f:loadBundle basename="MessageResources" var="bundle" />
> > <f:view>
> >     <html>
> >     <head>
> >     <title>Sub Category Admin</title>
> >     </head>
> >
> >     <body>
> >     <f:subview id="header">
> >         <jsp:include page=" Header.jsp" />
> >     </f:subview>
> >     <t:messages />
> >     <h:form id="subCategoryAdminForm">
> >     <t:saveState value="#{SubCategoryAdminBean.currentCategory}"/>
> >         <t:panelGrid columns="2" cellpadding="0" cellspacing="0">
> >             <t:panelGrid columns="1">
> >                 <f:facet name="header">
> >                     <t:outputText value="Sub Category List" />
> >                 </f:facet>
> >                 <t:panelGrid columns="2">
> >                     <t:outputText value="Filter" />
> >                     <t:panelGroup />
> >
> >                     <t:outputText value="Category" />
> >                     <t:selectOneMenu
> >                         binding="#{
> > SubCategoryAdminBean.parentCategoriesSelectOneMenu }"
> >                         value="#{
> > SubCategoryAdminBean.parentCategory.categoryId}" />
> >
> >                     <t:panelGroup />
> >                     <t:commandButton value="OK" />
> >                 </t:panelGrid>
> >
> >                 <t:dataTable var="category"
> >                     binding="#{SubCategoryAdminBean.categoryData}"
> >                     value="#{ SubCategoryAdminBean.categories }">
> >                     <t:column>
> >                         <t:commandLink id="editCatLink"
> >                             actionListener="#{
> > SubCategoryAdminBean.editCategory}">
> >                             <t:outputText value="#{category.categoryName}"
> > />
> >                             <t:updateActionListener
> >                                 property="#{
> > SubCategoryAdminBean.currentCategory }"
> >                                 value="#{category}" />
> >                         </t:commandLink>
> >                     </t:column>
> >                 </t:dataTable>
> >             </t:panelGrid>
> >             <t:panelGrid columns="1">
> >                 <t:inputText
> >                     value="#{
> > SubCategoryAdminBean.currentCategory.categoryName}" />
> >             </t:panelGrid>
> >         </t:panelGrid>
> >     </h:form>
> >     <ft:trace showTree="true" />
> >     </body>
> >     </html>
> > </f:view>
> >
> > public class SubCategoryAdminBean extends BaseBean
> > {
> >     private Category currentCategory;
> >     private Category parentCategory;
> >     private CategoryService categoryService;
> >     private UIData categoryData;
> >     private KeywordService keywordService;
> >     private String parentCatId;
> >     private HtmlSelectOneMenu parentCategoriesSelectOneMenu;
> >
> >     public void setKeywordService(KeywordService keywordService)
> >     {
> >         this.keywordService = keywordService;
> >     }
> >
> >     public UIData getCategoryData()
> >     {
> >         return categoryData;
> >     }
> >
> >     public void setCategoryData(UIData categoryData)
> >     {
> >         this.categoryData = categoryData;
> >     }
> >
> >     public Category getCurrentCategory()
> >     {
> >         return currentCategory;
> >     }
> >
> >     public void setCurrentCategory(Category currentCategory)
> >     {
> >         this.currentCategory = currentCategory;
> >     }
> >
> >     public CategoryService getCategoryService()
> >     {
> >         return categoryService;
> >     }
> >
> >     public void setCategoryService(CategoryService categoryService)
> >     {
> >         this.categoryService = categoryService;
> >     }
> >
> >     public boolean isEditing()
> >     {
> >         if (currentCategory.getCategoryId() != null)
> >         {
> >             return true;
> >         }
> >         else
> >         {
> >             return false;
> >         }
> >     }
> >
> >     public List getCategories()
> >     {
> >         if (parentCategory.getCategoryId() == null)
> >         {
> >             return null;
> >         }
> >         return categoryService.getCategories(
> > parentCategory.getCategoryId(),
> >                 null, null);
> >     }
> >
> >     public String getParentCatId()
> >     {
> >         return parentCatId;
> >     }
> >
> >     public void setParentCatId(String parentCatId)
> >     {
> >         this.parentCatId = parentCatId;
> >     }
> >
> >     public Category getParentCategory()
> >     {
> >         return parentCategory;
> >     }
> >
> >     public void setParentCategory(Category parentCategory)
> >     {
> >         this.parentCategory = parentCategory;
> >     }
> >
> >     public HtmlSelectOneMenu getParentCategoriesSelectOneMenu()
> >     {
> >         if (parentCategoriesSelectOneMenu == null)
> >         {
> >             parentCategoriesSelectOneMenu = new HtmlSelectOneMenu();
> >         }
> >         final List list = new ArrayList();
> >         List categoryList = categoryService.getCategories(null, null,
> > null);
> >         Iterator iter = categoryList.iterator();
> >         while(iter.hasNext ())
> >         {
> >             Category category = (Category)iter.next();
> >             list.add(new SelectItem(category.getCategoryId().toString(),
> > category.getCategoryName()));
> >
> >         }
> >         final UISelectItems items = new UISelectItems();
> >         items.setValue(list);
> >         parentCategoriesSelectOneMenu.getChildren().add(items);
> >         return parentCategoriesSelectOneMenu;
> >     }
> >
> >     public void setParentCategoriesSelectOneMenu(
> >             HtmlSelectOneMenu parentCategoriesSelectOneMenu)
> >     {
> >         this.parentCategoriesSelectOneMenu =
> > parentCategoriesSelectOneMenu;
> >     }
> >
> >
> >     public void editCategory(ActionEvent event)
> >     {
> >         System.out.println(currentCategory.getCategoryName ());
> >         System.out.println(parentCategory.getCategoryName());
> >
> >     }
> > }
> >
> >
> > On 6/22/06, Gregg Bolinger < gdboling.myfaces@gmail.com> wrote:
> > >
> > > I have a page where the commandLink isn't triggering the associated
> > > actionListener.  The link on the page is identical to the link on another
> > > similar page.  They are just using different managed beans.
> > >
> > >
> > > <t:dataTable var="category"
> > >                     binding="#{SubCategoryAdminBean.categoryData}"
> > >                     value="#{SubCategoryAdminBean.categories}">
> > >                     <t:column>
> > >                         <t:commandLink id="editCatLink"
> > >                             actionListener="#{
> > > SubCategoryAdminBean.editCategory}">
> > >                             <t:outputText value="#{
> > > category.categoryName}" />
> > >                             <t:updateActionListener
> > >                                 property="#{
> > > SubCategoryAdminBean.currentCategory}"
> > >                                 value="#{category}" />
> > >                         </t:commandLink>
> > >                     </t:column>
> > >                 </t:dataTable>
> > >
> > >
> > > I started using FacesTrace to see if I could see any useful
> > > information.  And what I've discovered is that when processing the page that
> > > works I get the following key/value:
> > >
> > > categoryAdminForm:_link_hidden_       --
> > > categoryAdminForm:_idJsp15:1:_idJsp18
> > >
> > > However, when I click the link on the page that doesn't work I get
> > >
> > > categoryAdminForm:_link_hidden_       --
> > >
> > > No value.  Problem is, I have no clue what that tells me.  Anyone?
> > >
> > > Thanks.
> > >
> >
> >
>

Re: commandLink not working: FaceTrace

Posted by Gregg Bolinger <gd...@gmail.com>.
To add another piece to the puzzle, I placed a commandLink with a different
ID and the same actionListener outside othe dataTable, and it triggers the
actionListener method just fine.

Thanks.

On 6/22/06, Gregg Bolinger <gd...@gmail.com> wrote:
>
> Let me deliver this problem a bit differently.  I apologize in advance for
> the long bit of code I am about to post.  I've stripped the page of
> everything except what is causing the problem and also stripped down the
> managed bean to just support the page.
>
> The commandLinks arren't triggering the actionListener.  I am hoping a
> fresh set of eyes will be able to clue me in to why.  Hopefully it is
> something simple.  Putting the managed bean in session scope allows
> everything to work.  But when in request scope, it doesn't work.
>
> JDK1.4
> Tomcat 5.0.28
> MyFaces 1.1.3
> Tomahawk 1.1.2
>
> <%@ taglib uri="http://java.sun.com/jsf/html" prefix="h"%>
> <%@ taglib uri=" http://java.sun.com/jsf/core" prefix="f"%>
> <%@ taglib uri="http://myfaces.apache.org/tomahawk" prefix="t"%>
> <%@ taglib uri="http://sourceforge.net/projects/facestrace" prefix="ft"%>
> <f:loadBundle basename="MessageResources" var="bundle" />
> <f:view>
>     <html>
>     <head>
>     <title>Sub Category Admin</title>
>     </head>
>
>     <body>
>     <f:subview id="header">
>         <jsp:include page=" Header.jsp" />
>     </f:subview>
>     <t:messages />
>     <h:form id="subCategoryAdminForm">
>     <t:saveState value="#{SubCategoryAdminBean.currentCategory}"/>
>         <t:panelGrid columns="2" cellpadding="0" cellspacing="0">
>             <t:panelGrid columns="1">
>                 <f:facet name="header">
>                     <t:outputText value="Sub Category List" />
>                 </f:facet>
>                 <t:panelGrid columns="2">
>                     <t:outputText value="Filter" />
>                     <t:panelGroup />
>
>                     <t:outputText value="Category" />
>                     <t:selectOneMenu
>                         binding="#{
> SubCategoryAdminBean.parentCategoriesSelectOneMenu }"
>                         value="#{
> SubCategoryAdminBean.parentCategory.categoryId}" />
>
>                     <t:panelGroup />
>                     <t:commandButton value="OK" />
>                 </t:panelGrid>
>
>                 <t:dataTable var="category"
>                     binding="#{SubCategoryAdminBean.categoryData}"
>                     value="#{SubCategoryAdminBean.categories }">
>                     <t:column>
>                         <t:commandLink id="editCatLink"
>                             actionListener="#{
> SubCategoryAdminBean.editCategory}">
>                             <t:outputText value="#{category.categoryName}"
> />
>                             <t:updateActionListener
>                                 property="#{
> SubCategoryAdminBean.currentCategory }"
>                                 value="#{category}" />
>                         </t:commandLink>
>                     </t:column>
>                 </t:dataTable>
>             </t:panelGrid>
>             <t:panelGrid columns="1">
>                 <t:inputText
>                     value="#{
> SubCategoryAdminBean.currentCategory.categoryName}" />
>             </t:panelGrid>
>         </t:panelGrid>
>     </h:form>
>     <ft:trace showTree="true" />
>     </body>
>     </html>
> </f:view>
>
> public class SubCategoryAdminBean extends BaseBean
> {
>     private Category currentCategory;
>     private Category parentCategory;
>     private CategoryService categoryService;
>     private UIData categoryData;
>     private KeywordService keywordService;
>     private String parentCatId;
>     private HtmlSelectOneMenu parentCategoriesSelectOneMenu;
>
>     public void setKeywordService(KeywordService keywordService)
>     {
>         this.keywordService = keywordService;
>     }
>
>     public UIData getCategoryData()
>     {
>         return categoryData;
>     }
>
>     public void setCategoryData(UIData categoryData)
>     {
>         this.categoryData = categoryData;
>     }
>
>     public Category getCurrentCategory()
>     {
>         return currentCategory;
>     }
>
>     public void setCurrentCategory(Category currentCategory)
>     {
>         this.currentCategory = currentCategory;
>     }
>
>     public CategoryService getCategoryService()
>     {
>         return categoryService;
>     }
>
>     public void setCategoryService(CategoryService categoryService)
>     {
>         this.categoryService = categoryService;
>     }
>
>     public boolean isEditing()
>     {
>         if (currentCategory.getCategoryId() != null)
>         {
>             return true;
>         }
>         else
>         {
>             return false;
>         }
>     }
>
>     public List getCategories()
>     {
>         if (parentCategory.getCategoryId() == null)
>         {
>             return null;
>         }
>         return categoryService.getCategories(parentCategory.getCategoryId
> (),
>                 null, null);
>     }
>
>     public String getParentCatId()
>     {
>         return parentCatId;
>     }
>
>     public void setParentCatId(String parentCatId)
>     {
>         this.parentCatId = parentCatId;
>     }
>
>     public Category getParentCategory()
>     {
>         return parentCategory;
>     }
>
>     public void setParentCategory(Category parentCategory)
>     {
>         this.parentCategory = parentCategory;
>     }
>
>     public HtmlSelectOneMenu getParentCategoriesSelectOneMenu()
>     {
>         if (parentCategoriesSelectOneMenu == null)
>         {
>             parentCategoriesSelectOneMenu = new HtmlSelectOneMenu();
>         }
>         final List list = new ArrayList();
>         List categoryList = categoryService.getCategories(null, null,
> null);
>         Iterator iter = categoryList.iterator();
>         while(iter.hasNext ())
>         {
>             Category category = (Category)iter.next();
>             list.add(new SelectItem(category.getCategoryId().toString(),
> category.getCategoryName()));
>
>         }
>         final UISelectItems items = new UISelectItems();
>         items.setValue(list);
>         parentCategoriesSelectOneMenu.getChildren().add(items);
>         return parentCategoriesSelectOneMenu;
>     }
>
>     public void setParentCategoriesSelectOneMenu(
>             HtmlSelectOneMenu parentCategoriesSelectOneMenu)
>     {
>         this.parentCategoriesSelectOneMenu =
> parentCategoriesSelectOneMenu;
>     }
>
>
>     public void editCategory(ActionEvent event)
>     {
>         System.out.println(currentCategory.getCategoryName ());
>         System.out.println(parentCategory.getCategoryName());
>
>     }
> }
>
>
> On 6/22/06, Gregg Bolinger < gdboling.myfaces@gmail.com> wrote:
> >
> > I have a page where the commandLink isn't triggering the associated
> > actionListener.  The link on the page is identical to the link on another
> > similar page.  They are just using different managed beans.
> >
> >
> > <t:dataTable var="category"
> >                     binding="#{SubCategoryAdminBean.categoryData}"
> >                     value="#{SubCategoryAdminBean.categories}">
> >                     <t:column>
> >                         <t:commandLink id="editCatLink"
> >                             actionListener="#{
> > SubCategoryAdminBean.editCategory}">
> >                             <t:outputText value="#{category.categoryName}"
> > />
> >                             <t:updateActionListener
> >                                 property="#{
> > SubCategoryAdminBean.currentCategory}"
> >                                 value="#{category}" />
> >                         </t:commandLink>
> >                     </t:column>
> >                 </t:dataTable>
> >
> >
> > I started using FacesTrace to see if I could see any useful
> > information.  And what I've discovered is that when processing the page that
> > works I get the following key/value:
> >
> > categoryAdminForm:_link_hidden_       --
> > categoryAdminForm:_idJsp15:1:_idJsp18
> >
> > However, when I click the link on the page that doesn't work I get
> >
> > categoryAdminForm:_link_hidden_       --
> >
> > No value.  Problem is, I have no clue what that tells me.  Anyone?
> >
> > Thanks.
> >
>
>

Re: commandLink not working: FaceTrace

Posted by Gregg Bolinger <gd...@gmail.com>.
Let me deliver this problem a bit differently.  I apologize in advance for
the long bit of code I am about to post.  I've stripped the page of
everything except what is causing the problem and also stripped down the
managed bean to just support the page.

The commandLinks arren't triggering the actionListener.  I am hoping a fresh
set of eyes will be able to clue me in to why.  Hopefully it is something
simple.  Putting the managed bean in session scope allows everything to
work.  But when in request scope, it doesn't work.

JDK1.4
Tomcat 5.0.28
MyFaces 1.1.3
Tomahawk 1.1.2

<%@ taglib uri="http://java.sun.com/jsf/html" prefix="h"%>
<%@ taglib uri="http://java.sun.com/jsf/core" prefix="f"%>
<%@ taglib uri="http://myfaces.apache.org/tomahawk" prefix="t"%>
<%@ taglib uri="http://sourceforge.net/projects/facestrace" prefix="ft"%>
<f:loadBundle basename="MessageResources" var="bundle" />
<f:view>
    <html>
    <head>
    <title>Sub Category Admin</title>
    </head>

    <body>
    <f:subview id="header">
        <jsp:include page="Header.jsp" />
    </f:subview>
    <t:messages />
    <h:form id="subCategoryAdminForm">
    <t:saveState value="#{SubCategoryAdminBean.currentCategory}"/>
        <t:panelGrid columns="2" cellpadding="0" cellspacing="0">
            <t:panelGrid columns="1">
                <f:facet name="header">
                    <t:outputText value="Sub Category List" />
                </f:facet>
                <t:panelGrid columns="2">
                    <t:outputText value="Filter" />
                    <t:panelGroup />

                    <t:outputText value="Category" />
                    <t:selectOneMenu
                        binding="#{
SubCategoryAdminBean.parentCategoriesSelectOneMenu}"
                        value="#{
SubCategoryAdminBean.parentCategory.categoryId}" />

                    <t:panelGroup />
                    <t:commandButton value="OK" />
                </t:panelGrid>
                <t:dataTable var="category"
                    binding="#{SubCategoryAdminBean.categoryData}"
                    value="#{SubCategoryAdminBean.categories}">
                    <t:column>
                        <t:commandLink id="editCatLink"
                            actionListener="#{
SubCategoryAdminBean.editCategory}">
                            <t:outputText value="#{category.categoryName}"
/>
                            <t:updateActionListener
                                property="#{
SubCategoryAdminBean.currentCategory}"
                                value="#{category}" />
                        </t:commandLink>
                    </t:column>
                </t:dataTable>
            </t:panelGrid>
            <t:panelGrid columns="1">
                <t:inputText
                    value="#{
SubCategoryAdminBean.currentCategory.categoryName}" />
            </t:panelGrid>
        </t:panelGrid>
    </h:form>
    <ft:trace showTree="true" />
    </body>
    </html>
</f:view>

public class SubCategoryAdminBean extends BaseBean
{
    private Category currentCategory;
    private Category parentCategory;
    private CategoryService categoryService;
    private UIData categoryData;
    private KeywordService keywordService;
    private String parentCatId;
    private HtmlSelectOneMenu parentCategoriesSelectOneMenu;

    public void setKeywordService(KeywordService keywordService)
    {
        this.keywordService = keywordService;
    }

    public UIData getCategoryData()
    {
        return categoryData;
    }

    public void setCategoryData(UIData categoryData)
    {
        this.categoryData = categoryData;
    }

    public Category getCurrentCategory()
    {
        return currentCategory;
    }

    public void setCurrentCategory(Category currentCategory)
    {
        this.currentCategory = currentCategory;
    }

    public CategoryService getCategoryService()
    {
        return categoryService;
    }

    public void setCategoryService(CategoryService categoryService)
    {
        this.categoryService = categoryService;
    }

    public boolean isEditing()
    {
        if (currentCategory.getCategoryId() != null)
        {
            return true;
        }
        else
        {
            return false;
        }
    }

    public List getCategories()
    {
        if (parentCategory.getCategoryId() == null)
        {
            return null;
        }
        return categoryService.getCategories(parentCategory.getCategoryId(),
                null, null);
    }

    public String getParentCatId()
    {
        return parentCatId;
    }

    public void setParentCatId(String parentCatId)
    {
        this.parentCatId = parentCatId;
    }

    public Category getParentCategory()
    {
        return parentCategory;
    }

    public void setParentCategory(Category parentCategory)
    {
        this.parentCategory = parentCategory;
    }

    public HtmlSelectOneMenu getParentCategoriesSelectOneMenu()
    {
        if (parentCategoriesSelectOneMenu == null)
        {
            parentCategoriesSelectOneMenu = new HtmlSelectOneMenu();
        }
        final List list = new ArrayList();
        List categoryList = categoryService.getCategories(null, null, null);
        Iterator iter = categoryList.iterator();
        while(iter.hasNext())
        {
            Category category = (Category)iter.next();
            list.add(new SelectItem(category.getCategoryId().toString(),
category.getCategoryName()));

        }
        final UISelectItems items = new UISelectItems();
        items.setValue(list);
        parentCategoriesSelectOneMenu.getChildren().add(items);
        return parentCategoriesSelectOneMenu;
    }

    public void setParentCategoriesSelectOneMenu(
            HtmlSelectOneMenu parentCategoriesSelectOneMenu)
    {
        this.parentCategoriesSelectOneMenu = parentCategoriesSelectOneMenu;
    }


    public void editCategory(ActionEvent event)
    {
        System.out.println(currentCategory.getCategoryName());
        System.out.println(parentCategory.getCategoryName());
    }
}


On 6/22/06, Gregg Bolinger <gd...@gmail.com> wrote:
>
> I have a page where the commandLink isn't triggering the associated
> actionListener.  The link on the page is identical to the link on another
> similar page.  They are just using different managed beans.
>
>
> <t:dataTable var="category"
>                     binding="#{SubCategoryAdminBean.categoryData}"
>                     value="#{SubCategoryAdminBean.categories}">
>                     <t:column>
>                         <t:commandLink id="editCatLink"
>                             actionListener="#{
> SubCategoryAdminBean.editCategory}">
>                             <t:outputText value="#{category.categoryName}"
> />
>                             <t:updateActionListener
>                                 property="#{
> SubCategoryAdminBean.currentCategory}"
>                                 value="#{category}" />
>                         </t:commandLink>
>                     </t:column>
>                 </t:dataTable>
>
>
> I started using FacesTrace to see if I could see any useful information.
> And what I've discovered is that when processing the page that works I get
> the following key/value:
>
> categoryAdminForm:_link_hidden_       --
> categoryAdminForm:_idJsp15:1:_idJsp18
>
> However, when I click the link on the page that doesn't work I get
>
> categoryAdminForm:_link_hidden_       --
>
> No value.  Problem is, I have no clue what that tells me.  Anyone?
>
> Thanks.
>