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

Posted on 2009-02-08
Last Modified: 2013-11-24
I have the following a4j:commandButton:

<a4j:commandButton id="runButton" value="Run Now"
                          onclick="this.disabled=true;this.value='Running ...'"
                          oncomplete="this.disabled=false;this.value='Run Now'"">

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="#{}" assignTo="#{ViewResult.resultId}"/>

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.

Question by:qrahman
    1 Comment
    LVL 22

    Accepted Solution

    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,

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    Threat Intelligence Starter Resources

    Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

    Introduction This article is the last of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article covers our test design approach and then goes through a simple test case example, how …
    International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
    The viewer will learn how to implement Singleton Design Pattern in Java.
    This tutorial covers a practical example of lazy loading technique and early loading technique in a Singleton Design Pattern.

    761 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    7 Experts available now in Live!

    Get 1:1 Help Now