2011-12-30 3 views

答えて

2

すでにJSF2を使用しているので、必要な場所に<f:ajax execute="@form" render="@form">を持ち込んで、非同期要求による同期要求を置き換えることを検討してください。

など。

<h:form> 
    <h:messages /> 
    <h:inputText required="true" /> 
    ... 
    <h:commandButton value="submit"> 
     <f:ajax execute="@form" render="@form"> 
    </h:commandButton> 
</h:form> 

<h:form> 
    <h:messages /> 
    <h:inputText required="true" /> 
    ... 
    <h:commandButton value="submit"> 
     <f:ajax execute="@form" render="@form"> 
    </h:commandButton> 
</h:form> 

この方法でのみ、現在<h:form>の内容は、提出時に再レンダリングされます。さらに、ajaxを使用することでフィードバックが速くなり、ユーザーエクスペリエンスが向上します。

これは何らかの理由でオプションではない場合は、rendered属性を使用して、呼び出されるボタン(名前=値のペア(クライアントID))に応じて<h:messages>コンポーネントを条件付きで表示することをお勧めしますその後、要求パラメータマップに)。

<h:form> 
    <h:messages rendered="#{not empty param[button1.clientId]}" /> 
    <h:inputText required="true" /> 
    ... 
    <h:commandButton binding="#{button1}" value="submit" /> 
</h:form> 

<h:form> 
    <h:messages rendered="#{not empty param[button2.clientId]}" /> 
    <h:inputText required="true" /> 
    ... 
    <h:commandButton binding="#{button2}" value="submit" /> 
</h:form> 
+0

おかげで、私は '<のcommandButton ID = "sendButton"/ H>するように第二の溶液を修飾メッセージがレンダリング= "#{FN:containsIgnoreCase(PARAM、 'sendButton')}" /> ' – mm1

関連する問題