users@glassfish.java.net

JSF - commandLink and dataTable issue

From: Antonio Goncalves <antonio.mailing_at_gmail.com>
Date: Wed, 27 Sep 2006 16:50:46 +0200

*There is no dedicated JSF mailing list for Glassfish, I hope this is the
correct list to post on JSF.*


Hi,

I'm using Glassfish V2b13 with JSF 1.2 and I have a problem with commandLink
inside dataTable. It just doesn't work. I've read on older mailing lists
(like 2 years ago) that it was a known bug and it should be solved in future
versions (it was JSF 1.1 at the time). Imagine the petstore application,
with a navigation bar that gives you the products for a given category, the
list of product is displayed with a link, when you click on it it shows the
items for this given product (master/detail kind of thing).

First, I've tried commandLink inside dataTable but when clicking the page
remains the same :

        <h:form>
            <h:dataTable value="#{catalog.products}" var="product">
                <h:column>
                    <h:panelGroup>
                        <h:commandLink action="#{catalog.doFindItems}">
                            <h:outputText value="a l interieur du panel
group"/>
                            <f:param name="productId" value="1"/>
                        </h:commandLink><br/>
                    </h:panelGroup>
                </h:column>
            </h:dataTable>
        </h:form>

I've tried to move the form tag around the commandLink but it still doesn't
work

        <h:dataTable value="#{catalog.products}" var="product">
            <h:column>
                <h:panelGroup>
                    <h:form>
                        <h:commandLink action="#{catalog.doFindItems}">
                            <h:outputText value="a l interieur du form"/>
                            <f:param name="productId" value="1"/>
                        </h:commandLink><br/>
                    </h:form>
                </h:panelGroup>
            </h:column>
        </h:dataTable>

And when I take my commandLink out of the dataTable, it works fine... but I
can't iterate through my list

        <h:form>
            <h:commandLink action="#{catalog.doFindItems}">
                <h:outputText value="a l exterieur de la boucla dans le
form"/>
                <f:param name="productId" value="1"/>
            </h:commandLink><br/>
        </h:form>

The fact that this is working shows that my navigation and back bean is
working. Is it a bug, a limitation of JSF or is there another way to iterate
over a collection without using the dataTable ?

Thanks,

Antonio