We help IT Professionals succeed at work.

We've partnered with Certified Experts, Carl Webster and Richard Faulkner, to bring you a podcast all about Citrix Workspace, moving to the cloud, and analytics & intelligence. Episode 2 coming soon!Listen Now

x

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

qrahman
qrahman asked
on
Medium Priority
6,982 Views
Last Modified: 2013-11-24
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.

Comment
Watch Question

Commented:
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¤

Not the solution you were looking for? Getting a personalized solution is easy.

Ask the Experts
Access more of Experts Exchange with a free account
Thanks for using Experts Exchange.

Create a free account to continue.

Limited access with a free account allows you to:

  • View three pieces of content (articles, solutions, posts, and videos)
  • Ask the experts questions (counted toward content limit)
  • Customize your dashboard and profile

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

OR

Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.