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 < [EMAIL PROTECTED]> 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.

Reply via email to