我的问题是我无法使用 spring webflow 显示弹出窗口。我有一个屏幕 A ,其中基于特定标志,我想在单击命令按钮(primefaces 或 Spring faces)时显示弹出窗口 B。
我尝试了以下操作
我的网络流程看起来像
<view-state id="accSummary">
<transition on="searchRequest" to="startRequest" />
<transition on="addRequest" to="PopUpViewState" />
</view-state>
<view-state id="PopUpViewState" popup="true"
redirect="true">
</view-state>
Xhtml 看起来像
<p:commandButton value="#{label.addRequest}" action="addRequest" />
似乎 popup="true"
不起作用。
请帮忙。
SWF 2.3.0; Primefaces 2.2.1; JSF 2; Spring 安全3; Spring 3.1.0M1; EhCache; Apache 汤姆猫6.0; STS 2.5.1
最佳答案
SWF 2.3.0 似乎还不支持 popup="true"
。根据SWF文档http://static.springsource.org/spring-webflow/docs/2.3.x/reference/html/ch13.html :
Also note that the Spring Faces component library, which provides Ajax and client-side validation capabilities is for JSF 1.2 environments only and will not be upgraded to JSF 2.0. Applications are encouraged to use 3rd party JSF 2 component libraries such as PrimeFaces and RichFaces. The swf-booking-faces sample in the Spring Web Flow distribution for example is built with JSF 2 and PrimeFaces components.
由于 SWF 弹出窗口是基于 Ajax 的,我猜这不适用于 JSF2。
替代方案可以使用 rich:popupPanel modal="true"
或 PrimeFaces 中的类似内容,但到目前为止,我不知道如何将 popup="true"
从 JSF1.2 平滑/快速过渡到 JSF2 中的内容。
编辑:
要在 JSF2 中启用 spring-faces Ajax 功能(包括 popup="true"
),请对流处理程序适配器配置进行以下更改:
<bean class="org.springframework.js.ajax.SpringJavascriptAjaxHandler"
id="springAjaxHandler">
</bean>
<bean class="org.springframework.faces.webflow.JsfAjaxHandler"
id="jsfAjaxHandler">
<constructor-arg ref="springAjaxHandler"/>
</bean>
<bean class="org.springframework.faces.webflow.JsfFlowHandlerAdapter">
<property name="flowExecutor" ref="flowExecutor"/>
<property name="ajaxHandler" ref="jsfAjaxHandler"/>
</bean>
完成此操作后,SWF 弹出窗口和其他组件(sf 命令按钮、链接等)可以正常工作。 这不是 JSF2 配置的“官方”解决方案或建议,因此使用它的风险由您自行承担。
关于java - 弹出 ="true"无法在 JSF 2.0 环境的 Spring webflow 2.3.0 中使用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7148524/