java - 弹出 ="true"无法在 JSF 2.0 环境的 Spring webflow 2.3.0 中使用

标签 java jsf-2 spring-webflow

我的问题是我无法使用 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/

相关文章:

jsf - 为什么 firefox 文件下载在 Tomcat 中运行?

html - 如何将 HTML 代码导入 JSF 页面?

java - 提交后Spring Web流不重定向

java - 手动释放流范围内的对象以进行垃圾回收

java - C++ 概念和 Java 接口(interface)有什么区别?

java - 在 list 中设置的 Android 自定义应用程序类不适用于 ClassCastException

java - 按后退按钮时 Activity 不发送结果

java - ViewFlipper的具体布局

java - 得到<h :outputText> as ManagedProperty in backing bean

java - spring webflow 中的重定向错误消息