0

私はPrimeFacesを使用しています。PrimeFaces コンポーネントの InputText を使用して、多くのダイアログを正常に実装しました。数値の入力フォーマットと検証を改善するために、PrimeFaces Extensions のコンポーネント InputNumber を調べました。しかし、このコンポーネントを使用していると、ボタンをクリックしてもダイアログが開きません。

さらにテストと調査を重ねた結果、問題は使用されているロケールに依存していると、より具体的に言えます。したがって、「de」や「en」などのロケールは問題ありませんが、「de-ch」はそうではありません。'de-ch' の場合、特殊文字アポストロフィ'が 3 桁区切りとして使用されます。

そのため、1000 桁または 10 進数の区切り記号としてアポストロフィを使用すると、エラーが発生します。

Internet Explorer 11 では、次のエラーが表示されます。

SCRIPT1009: '}' expected
file: jquery.js.xhtml, row: 14, column: 2888
globalEval:function(e){if(e&&bI.trim(e)){(a5.execScript||function(i){a5["eval"].call(a5,i)})(e)}},camelCase:function(e){return e.replace(bS,"ms-")

エラーはa5["eval"].call(a5,i) にあります

firefox 33.0 では、次のエラーが表示されます。

SyntaxError: missing } after property list

問題を次のコードに減らしました。

入力番号.xhtml:

<html xmlns="http://www.w3.org/1999/xhtml"  
      xmlns:h="http://java.sun.com/jsf/html"  
      xmlns:ui="http://xmlns.jcp.org/jsf/facelets"
      xmlns:f="http://java.sun.com/jsf/core"
      xmlns:pe="http://primefaces.org/ui/extensions"  
      xmlns:p="http://primefaces.org/ui">  

    <h:head>  

    </h:head>  

    <h:body>  

        <h:form>
            <p:panelGrid columns="4">
                <p:commandButton id="btnActionListenerPinputText"
                                 value="InputText Dialog via ActionListener"
                                 actionListener="#{dtDialogView.onShowPITDialog}"/>
                <p:commandButton id="btnOnSuccessPinputText"
                                 value="InputText Dialog via OnSuccess"
                                 onsuccess="PF('pitDlg').show();"/>
                <p:commandButton id="btnOnClickPinputText"
                                 value="InputText Dialog via OnClick"
                                 onclick="PF('pitDlg').show();"/>
                <p:commandButton id="btnOnCompletePinputText"
                                 value="InputText Dialog via OnComplete"
                                 oncomplete="PF('pitDlg').show();"/>

                <p:commandButton id="btnActionListenerPEinputNumber"
                                 value="InputNumber Dialog via ActionListener"
                                 actionListener="#{dtDialogView.onShowPEINDialog}"/>
                <p:commandButton id="btnOnSuccessPEinputNumber"
                                 value="InputNumber Dialog via OnSuccess"
                                 onsuccess="PF('peinDlg').show();"/>
                <p:commandButton id="btnOnClickPEinputNumber"
                                 value="InputNumber Dialog via OnClick"
                                 onclick="PF('peinDlg').show();"/>
                <p:commandButton id="btnOnCompletePEinputNumber"
                                 value="InputNumber Dialog via OnComplete"
                                 oncomplete="PF('peinDlg').show();"/>
            </p:panelGrid>
        </h:form>

        <!-- primefaces inputText dialog -->
        <h:form id="form-dlgpit">
            <p:dialog id="dlgpit"
                      header="PrimeFaces Input Text"
                      widgetVar="pitDlg"
                      resizable="false"
                      dynamic="true"
                      modal="true">

                <h:outputText id="amount_label" value="Amount"/>
                <p:inputText id="amount_value" value="#{dtDialogView.amount}" />

                <p:commandButton id="btnPitSave"
                                 value="Save"
                                 oncomplete="{PF('pitDlg').hide();}"/>
            </p:dialog>
        </h:form>

        <!-- primefaces extensions inputNumber dialog -->
        <h:form id="form-dlgpein">
            <p:dialog id="dlgpein"
                      header="PrimeFaces Extensions Input Number"
                      widgetVar="peinDlg"
                      resizable="false"
                      dynamic="true"
                      modal="true">

                <h:outputText id="amount_label" value="Amount"/>
                <pe:inputNumber id="amount_value" value="#{dtDialogView.amount}"
                                thousandSeparator="'"
                                decimalSeparator="."/>

                <p:commandButton id="btnPeinSave"
                                 value="Save"
                                 oncomplete="{PF('peinDlg').hide();}"/>
            </p:dialog>
        </h:form>
    </h:body>  
</html>  

DialogView.java

@ManagedBean(name = "dtDialogView")
@ViewScoped
public class DialogView implements Serializable {

    private Long amount;


    public Long getAmount() {
        return amount;
    }


    public void setAmount(Long amount) {
        this.amount = amount;
    }


    public void onShowPITDialog() {
        RequestContext.getCurrentInstance().execute("PF('pitDlg').show();");
    }


    public void onShowPEINDialog() {
        RequestContext.getCurrentInstance().execute("PF('peinDlg').show();");
    }
}

私が使用する環境:

  • プライムフェイス 5.1.3
  • PrimeFaces 拡張機能 3.0.0
  • トムキャット 8.0.14
  • Java サーバー フェース 2.2
4

1 に答える 1