1

しっかりと把握しようとしていますが、道ajaxに迷っているのではないかと心配しています。Wait以下のコードは、ボタンをクリックした後にボタンをレンダリングしJoinます。JoinボタンactionListenerも初めて呼び出されます。次に、 をクリックするWaitと、Joinボタンはレンダリングされますが、WaitボタンactionListenerは呼び出されません。最後に、クリックしてJoinも何も起こりません。これは、この質問のわずかなバリエーションです(私は望んでいます)(あなたの誰かが似たようなものを見た場合に備えて)

ajax レンダリング後に commandButton が非アクティブになる

これが重複した質問である場合は、申し訳ありません。BalusC が私が投稿した質問からすでにこれに回答した場合、私は率直に言って原因を理解していません。私はもはや何も意味をなさないところにいます。ばかげていると思いますが、誰かが何が起こっているのか説明してもらえますか?

<h:form>
    <p:commandButton id="Join" actionListener = "#{connexion.joinWaitingList}"
                     update="@form" rendered="#{connexion.renderJoinButton}"
                     value="Join"/>
    <p:commandButton id="leave" actionListener = "#{connexion.leaveWaitingList}" 
                     update="@form" rendered="#{connexion.renderWaitButton}" 
                     value="Wait"/>
</h:form>

Java コード

import javax.faces.bean.ManagedBean;
import javax.faces.bean.ViewScoped;

@ManagedBean
@ViewScoped
public class Connexion implements java.io.Serializable {
    private boolean renderJoinButton; 
    private boolean renderWaitButton; 

    public Connexion() {
        renderJoinButton = true; 
        renderWaitButton = false; 
    }

    public boolean isRenderJoinButton() {
        return renderJoinButton;
    }

    public void setRenderJoinButton(boolean renderJoinButton) {
        this.renderJoinButton = renderJoinButton;
    }

    public boolean isRenderWaitButton() {
        return renderWaitButton;
    }

    public void setRenderWaitButton(boolean renderWaitButton) {
        this.renderWaitButton = renderWaitButton;
    }

    public void joinWaitingList() {
        System.out.println("Waiting list joined"); 
        renderJoinButton = false; 
        renderWaitButton = true; 
    }

    public void leaveWaitingList() {
        System.out.println("Waiting list abandoned");
        renderJoinButton = true; 
        renderWaitButton = false; 
    }
}

アップデート

PrimeFaces 3.5 で JSF 2.2 を使用しています

更新 #2

これは、JSF 2.1 および 2.0.10 で動作するようです。JSF 2.2 では機能しません。この問題を Primefaces フォーラムに投稿しました。彼らから返信があり次第、この投稿を更新します。

更新 #3

jhond のおかげで、バグに気付きました。また、primefaces コミュニティ メンバーの 1 人から、「最新のスナップショットだけが互換性がある」との返事がありました。

4

0 に答える 0