1

i have a very simple code here:

<a4j:commandLink action="#{ticketAboxEventHelper.removeAboxTicket(ticketAbox)}"
                             onclick="if(!confirm('Are you sure ... ?')) return false;"
                             reRender="aboxlistpanel">
                        <h:graphicImage alt="Delete" url="../../img/dialog-error-5.png" title="Delete" />
                        <a4j:support event="oncomplete" 
                                     action="#{editTicketNewAction.testRerender()}" 
                                     reRender="aboxlistpanel"
                                     />
</a4j:commandLink>

When the link clicked the system must

  1. ask if the user is confirmed
  2. do the action
  3. rerender the aboxlistpanel

Now my problem is the rerendering is hapenning before the action is getting finished. any idea how it can be done in the right way?

Luiggi Mendoza
  • 85,076
  • 16
  • 154
  • 332
Ikthiander
  • 3,917
  • 8
  • 37
  • 54

2 Answers2

0

Your action methods is not valid for JSF 1.2 and you don't need the <a4j:support>. Since you want to pass a parameter, you should use <f:attribute /> and actionListener :

<a4j:commandLink actionListener="#{ticketAboxEventHelper.removeAboxTicket}" onclick="if(!confirm('Are you sure ... ?')) return false;" reRender="aboxlistpanel">
    <h:graphicImage alt="Delete" url="../../img/dialog-error-5.png" title="Delete" />
    <f:attribute name="ticket" value="#{ticketAbox}" />
</a4j:commandLink>

Your bean method will look like this :

public void removeAboxTicket(ActionEvent event)
{
    TicketAbox ticket = (TicketAbox)event.getComponent().getAttributes().get("ticket");

    // Your business logic
}

More info :

Alexandre Lavoie
  • 8,711
  • 3
  • 31
  • 72
  • no its fine, i am using seam 2 and jboss el expressions, so they work fine. but thanks for your input anyway – Ikthiander Jun 06 '13 at 17:03
0

Solved. I wrapped the offending JSF code in a and everything began working as expected. related to answer <a4j:commandLink> Not Rerendering. i solved it first and then found out someone else solved it in the same way. hmmm....

Community
  • 1
  • 1
Ikthiander
  • 3,917
  • 8
  • 37
  • 54