How to direct to a new page on a4j:commandButton onComplete

I have the following a4j:commandButton:

------------------------------------
<a4j:commandButton id="runButton" value="Run Now"
                          action="#{ContentReconciliationHome.reconcileContent}"
                          onclick="this.disabled=true;this.value='Running ...'"
                          oncomplete="this.disabled=false;this.value='Run Now'"">
 </a4j:commandButton>
----------------------------------

If this button is clicked, I want the user to be redirected to the following link:

------------------------------
 <a4j:commandLink id="latestResultLink" action="#{ContentReconciliationHome.viewResultAction}" value="View Latest Result">
                                <a4j:actionparam name="resultId" value="#{ContentReconciliationHome.latestContentReconciliationResult.id}" assignTo="#{ViewResult.resultId}"/>
 </a4j:commandLink>
---------------------------------

I have tried different things, but can't seem to make it work. What do I need to do to make it work? Thank you for your help.

qrahmanAsked:
Who is Participating?
 
mbonaciCommented:
Why use command link if you have the trigger for your event?
Simply do all you have to do in the method reconcileContent.

If you have some validation on form (including required attributes on input fields) use immediate="true" if you want the method called regardles of validation result.

If you want the action to redirect you to another page, use faces-config to speficy navigation rule and return the outcome as the string from reconcileContent.


Hope this helps,
Mb¤
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.