users@glassfish.java.net

Re: JSF - commandLink and dataTable issue

From: Antonio Goncalves <antonio.mailing_at_gmail.com>
Date: Wed, 27 Sep 2006 19:20:31 +0200

I FOUND IT !!! God, it's was a hard long bug that a had for few days and
could not solve. The answer is that my managed bean had a request scope.
Just changed it to session scope and it's working. I couldn't see anything
about that in the spec, but I'm happy that it's finally working.

So yes, the following code works, with one form and commandLink inside
dataTable

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

                        </h:commandLink>
                    </h:panelGroup>
                </h:column>
            </h:dataTable>
        </h:form>

Thanks for your replies,

Antonio


2006/9/27, jacob_at_hookom.net <jacob_at_hookom.net>:
>
> Your first example looks correct-- usually you only declare one h:form per
> page that surrounds all other components. You can put in multiple h:forms,
> but only to separate state. If you opt to use some of the ADF components
> with glassfish, I believe there are subform components available for use to
> break up page processing in delegated scopes.
>
> When you run into a case where you think you have the page right, but
> clicking just refreshes the page, you may want to check the logs or include
> an h:messages in your page since often times it ends up being a failed
> coversion or validation in the page.
>
>
> http://java.sun.com/javaee/javaserverfaces/1.2/docs/tlddocs/h/messages.html
>
> *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
> --------------------------------------------------------------------- To
> unsubscribe, e-mail: users-unsubscribe_at_glassfish.dev.java.net For
> additional commands, e-mail: users-help_at_glassfish.dev.java.net