私はp:inputTextareaを持っており、フォームの処理中にその値が必要です。私がフォームを提出するたびに、私はテキストエリアからのもの以外のすべての値を取得することが判明しました。 #{xyzUI.description}
は、通常のgetterとsetterを持つStringオブジェクトです。p:inputTextareaは空の文字列を返します
<ui:composition>
<h:form id="form1">
<p:panel rendered="...">
<p:panel id="formPanel">
<p:panelGrid columns="2" cellpadding="5">
<!-- other form elements -->
<p:outputLabel>Description:</p:outputLabel>
<p:inputTextarea value="#{xyzUI.description}" style="width: 350px;" counter="display" counterTemplate="{0} characters remaining" maxlength="2000" autoResize="true" rows="4" />
<h:panelGroup />
<h:outputText id="display" />
</p:panelGrid>
<p:commandButton rendered="#{not xyzUI.noChange}" action="#{xyzUI.submitForm}" update="formPanel" ajax="true" value="Apply" >
<p:ajax update="formPanel"></p:ajax>
</p:commandButton>
</p:panel>
</p:panel>
</h:form>
<ui:composition>
私のバッキングビーンでは、値は常に ""です。私は何が間違っているのか分からない。
public void submitForm()
{
...
tmp.setDescription(description); // String is always "" while debugging
myList.add(tmp);
RequestContext.getCurrentInstance().update("content");
}
のための私のバッキングBean
:これに
をコード。あなたのボタンはどこですか? Beanスコープとは何ですか? getter/setterを表示します。ネストされたフォームはありますか?もう少し表示する.. –
Beanスコープは@ViewScopedです。私は全体の景色を囲む1つのフォームしか持っていません。コードにボタンを追加しました。申し訳ありませんが、コードを読みやすくするためにトリムし、commandButtonを忘れました。 – baumlol
バッキングビーン全体を見ることができますか? @ JaqenH'gharが述べたように、あなたはその豆腐のセッターを失っている可能性があります –