You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@myfaces.apache.org by Stephen Osella <so...@austin.rr.com> on 2006/11/04 15:39:37 UTC

actionListener not being called with a4j:commandLink

In my ongoing attempt to use ajax4jsf....

I have an "a4jcommandLink" within an "h:dataTable":

<h:dataTable
    id="services"
    styleClass="services"
    value="#{SessionBean.services}"
    var="service"
    binding="#{SessionBean.servicesTable}"
    cellspacing="0">
    <h:column>
        <f:facet name="header">
            <h:outputText value="#{bundle.select_service}"/>
        </f:facet>
        <a4j:commandLink id="serviceAddButton" 
actionListener="#{SessionBean.serviceAddButtonActionListener}" 
reRender="ordersPG">
            <f:param id="serviceAddButtonIdx" name="serviceIdx" 
value="#{SessionBean.servicesTable.rowIndex}"/>
            <h:graphicImage id="addServiceButton" 
value="images/other/add-16x16.gif" width="16" height="16" 
alt="#{bundle.add_service}" />
        </a4j:commandLink>
    </h:column>
</h:dataTable>


The actionListener "SessionBean.serviceAddButtonActionListener" is not being 
called!  The ordersPG is an "h:panelGroup" in the form.

I put an "a4jstatus" in the form and that does work...goes from "ready" to 
"request under process" and back.  Yet nothing happens.  I even put an 
"ajaxListener" in the "a4jregion" (that contains the entire form), and a log 
message in there is getting logged.  So it seems that ajax4jsf *is* being 
invoked, yet the actionListener is not being called.  The backing bean is 
session scoped.

Any ideas or tips? 


Help!! actionListener not being called with a4j:commandLink and a4j:support

Posted by Stephen Osella <so...@austin.rr.com>.
Has anybody ever seen the behavior where the actionListener (or action for 
that matter) are not being called for a4j:commandLink or a4j:support?

What is the magic???

The code snippets are the following as examples:

<a4j:commandLink id="serviceAddButton" ajaxSingle="true" 
actionListener="#{SessionBean.serviceAddActionListener}" 
reRender="ordersPG,commandButtons">
    <h:graphicImage id="addServiceButton" value="images/other/add-16x16.gif" 
style="border-style:none;" width="16" height="16" 
alt="#{a4j_bundle.add_service}" />
    <f:param id="serviceAddIdx" name="serviceIdx" 
value="#{SessionBean.servicesTable.rowIndex}"/>
</a4j:commandLink>

and

<h:selectOneMenu id="endDayMenu" value="#{SessionBean.endDate.day}">
    <f:selectItems value="#{SessionBean.endDate.dayItems}" />
    <a4j:support event="onchange" ajaxSingle="true" 
actionListener="#{SessionBean.changeDateActionListener}" 
reRender="dateTimesDT,commandButtons" />
</h:selectOneMenu>


I am re-rendering lots of things: panelGroups, dataTables, outputTexts, etc.

There has to be something fundamental that I am not doing.  What could it 
be?  *Any* ideas?

Thanks for your help!


RE: actionListener not being called with a4j:commandLink

Posted by Michael Heinen <mh...@recommind.com>.
I need more code snippets for support.
What are you rerendering? An a4j:outputPanel?

I would not use immediate=true.
It causes trouble most of the times.

What about ajaxSingle=true for your link?
If you want to process more fields on the server, user an a4j:region
around your link.

MH

-----Original Message-----
From: Stephen Osella [mailto:sosella@austin.rr.com] 
Sent: Samstag, 4. November 2006 17:13
To: MyFaces Discussion
Subject: Re: actionListener not being called with a4j:commandLink

I got it to work when I specified immediate="true" on the
a4j:commandLink.

Now other wierd things are happening.  The header does not appear on the

re-rendered "h:dataTable" component.  Also, some the footers dont appear
if 
they contain bundle references.  I am going to try a4j:loadBundle.  Any 
suggestions there?  I figure I dont have to load the entire bundle.
Maybe 
have a small one just for re-rendering? 






Re: actionListener not being called with a4j:commandLink

Posted by Stephen Osella <so...@austin.rr.com>.
I got it to work when I specified immediate="true" on the a4j:commandLink.

Now other wierd things are happening.  The header does not appear on the 
re-rendered "h:dataTable" component.  Also, some the footers dont appear if 
they contain bundle references.  I am going to try a4j:loadBundle.  Any 
suggestions there?  I figure I dont have to load the entire bundle.  Maybe 
have a small one just for re-rendering? 


RE: actionListener not being called with a4j:commandLink

Posted by Michael Heinen <mh...@recommind.com>.
Did you try to use an af4j:actionparam or a t:actionListener instead of the f:param ?

Are you sure that the listener is not called or is only the rerendering not executed as expected?

Michael

-----Original Message-----
From: Stephen Osella [mailto:sosella@austin.rr.com] 
Sent: Samstag, 4. November 2006 15:40
To: MyFaces Discussion
Cc: Gerald Müllan
Subject: actionListener not being called with a4j:commandLink

In my ongoing attempt to use ajax4jsf....

I have an "a4jcommandLink" within an "h:dataTable":

<h:dataTable
    id="services"
    styleClass="services"
    value="#{SessionBean.services}"
    var="service"
    binding="#{SessionBean.servicesTable}"
    cellspacing="0">
    <h:column>
        <f:facet name="header">
            <h:outputText value="#{bundle.select_service}"/>
        </f:facet>
        <a4j:commandLink id="serviceAddButton" 
actionListener="#{SessionBean.serviceAddButtonActionListener}" 
reRender="ordersPG">
            <f:param id="serviceAddButtonIdx" name="serviceIdx" 
value="#{SessionBean.servicesTable.rowIndex}"/>
            <h:graphicImage id="addServiceButton" 
value="images/other/add-16x16.gif" width="16" height="16" 
alt="#{bundle.add_service}" />
        </a4j:commandLink>
    </h:column>
</h:dataTable>


The actionListener "SessionBean.serviceAddButtonActionListener" is not being 
called!  The ordersPG is an "h:panelGroup" in the form.

I put an "a4jstatus" in the form and that does work...goes from "ready" to 
"request under process" and back.  Yet nothing happens.  I even put an 
"ajaxListener" in the "a4jregion" (that contains the entire form), and a log 
message in there is getting logged.  So it seems that ajax4jsf *is* being 
invoked, yet the actionListener is not being called.  The backing bean is 
session scoped.

Any ideas or tips?