p:InputTextArea值没有得到最新值

时间:2013-06-13 17:48:26

标签: java spring jsf primefaces

我的应用程序中有一个奇怪的行为,我用完了解决它的选项,因为有时候它会起作用,有时则不起作用(取决于组件层次结构)。基本上,我正在使用inputTextArea并通过setPropertyActionListener将值发送到我的服务器,以便在我的应用程序上进一步使用逻辑。该功能实际上是一个评论列表。

<h:panelGroup rendered="#{(cc.attrs.requestCommentListComponentModel.requestCommentEditableMap[requestCommentVar.id]) and (cc.attrs.isModificationAllowed)}">
                                <div>
                                    <p:inputTextarea id="modifyRequestCommentInputTextArea" maxlength="255" styleClass="modifyRequestCommentInputTextArea" value="#{requestCommentVar.comment}" />
                                </div>

                                <h:panelGroup id="modifyRequestCommentControlButtonsPanelGroup" styleClass="requestCommentControlButtonsPanelGroup">
                                    <p:commandButton
                                        id="cancelRequestCommentModificationCommandButton"
                                        action="requestCommentListComponent.cancelEditRequestComment"
                                        onclick="jQuery.simpleBlockUI();cleanWatermark();"
                                        onerror="jQuery.unblockUI();"
                                        oncomplete="showWatermark();jQuery.unblockUI();closeComponent('#entityTaskManagementDialog');closeComponent('#quickTaskDialog');"
                                        process="@none"
                                        styleClass="requestCommentListComponentCommandButton"
                                        value="#{omnimed['global.cancel']}">
                                        <f:setPropertyActionListener target="#{cc.attrs.requestCommentListComponentModel.currentRequestComment}" value="#{requestCommentVar}" />
                                        <f:setPropertyActionListener target="#{conversationScope.requestCommentListComponentModel}" value="#{cc.attrs.requestCommentListComponentModel}" />
                                    </p:commandButton>
                                    <p:commandButton
                                        id="saveRequestCommentModificationCommandButton"
                                        action="requestCommentListComponent.updateRequestComment"
                                        onclick="jQuery.simpleBlockUI();cleanWatermark();"
                                        onerror="jQuery.unblockUI();"
                                        oncomplete="showWatermark();jQuery.unblockUI();closeComponent('#entityTaskManagementDialog');closeComponent('#quickTaskDialog');"
                                        styleClass="postButton requestCommentListComponentCommandButton"
                                        value="#{omnimed['global.save']}">
                                        <f:setPropertyActionListener target="#{cc.attrs.requestCommentListComponentModel.currentRequestComment}" value="#{requestCommentVar}" />
                                        <f:setPropertyActionListener target="#{conversationScope.requestCommentListComponentModel}" value="#{cc.attrs.requestCommentListComponentModel}" />
                                    </p:commandButton>
                                </h:panelGroup>
                            </h:panelGroup>

所以,问题是当我使用setPropertyActionListener获取值(#{requestCommentVar.comment})时。有一个值,但它总是旧的(也就是存储在模型中的那个)。如果我输入一个新文本,它仍然会返回旧值而没有错误。我之前已经完成了这个实现并且它有效。

另外,我应该说我在另一个组件中有一个组件。所以,我有一个A类的数据表(ui-repeat),其中每个都包含我父级组件中B类的数据表(ui-repeat)。然后我有一个子组件,每个A类都有一个C类数据表(ui-repeat).C类实际上是一个注释列表,当我试图修改注释时我遇到了问题。

1 个答案:

答案 0 :(得分:1)

请将您的process属性添加到commandButton,例如process="@this,modifyRequestCommentInputTextArea"

谢谢, 的Pankaj