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?

有帮助吗?

解决方案 2

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....

其他提示

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 :

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top