【问题标题】:Primefaces RowEditor does not work with Spring WebflowPrimefaces RowEditor 不适用于 Spring Webflow
【发布时间】:2012-11-16 18:18:18
【问题描述】:

我有带单元内编辑的 Primefaces 数据表:

        <p:dataTable id="docsTable" editable="true" value="#{customer.docs}" var="doc" style="border-width:0px;" >

            <p:growl id="docsMessages" showDetail="true"></p:growl>

            <p:ajax event="rowEdit" update="docsMessages,docsTable" listener="#{customerController.onEditDocument}"></p:ajax>
            <p:ajax event="rowEditCancel" update="docsMessages,docsTable" listener="#{customerController.onEditDocumentCancel}"></p:ajax>

            <p:column headerText="Document Type">
                <p:cellEditor>
                    <f:facet name="output">
                        <h:outputText value="#{doc.docType}"></h:outputText>
                    </f:facet>
                    <f:facet name="input">
                        <p:inputText value="#{doc.docType}"></p:inputText>
                    </f:facet>
                </p:cellEditor>
            </p:column>
            <p:column headerText="Document Number">
                <p:cellEditor>
                    <f:facet name="output">
                        <h:outputText value="#{doc.docNum}"></h:outputText>
                    </f:facet>
                    <f:facet name="input">
                        <p:inputText value="#{doc.docNum}"></p:inputText>
                    </f:facet>
                </p:cellEditor>
            </p:column>
            <p:column>
                <p:rowEditor></p:rowEditor>
            </p:column>
        </p:dataTable>

这里是对应的SWF视图状态定义:

<view-state id="enterDetails" view="/WEB-INF/views/tiles/customer/s3-custDetails.xhtml" model="customer"> <!-- tiles/customer/s3-custDetail -->
    <secured attributes="ROLE_WEB" />
    <var name="customerController" class="com.my.CustomerController"/>
    <transition on="addNewDocument">
        <evaluate expression="customer.docs.add(new com.my.CustomersDocs())"></evaluate>
        <render fragments="custDetails"></render>
    </transition>
</view-state>

视图渲染良好,值保存在支持 bean 中,并且在我的控制器中也调用了 rowEdit 侦听器。但是,无论用户做什么,它都不会退出编辑器模式。我做了一些网络嗅探,看起来 SWF 只是发回了视图状态,而 Primefaces 展示也发回了渲染片段。

我该如何解决这个问题?

【问题讨论】:

    标签: primefaces facelets spring-webflow spring-webflow-2


    【解决方案1】:

    这是 Spring webflow 中的一个错误/缺陷。它在 Spring 文档(参见 http://static.springsource.org/spring-webflow/docs/2.3.x/reference/html/ch13s10.html)中被提及,但以一种相当晦涩的方式提及,并且没有提及与部分渲染问题的关系。修复很简单,在 webflow:flow-executor 标签中添加以下内容:

            <webflow:flow-execution-attributes>
                <webflow:redirect-in-same-state value="false"/>
            </webflow:flow-execution-attributes>
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2014-02-16
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2012-12-16
      • 2017-11-30
      相关资源
      最近更新 更多