【发布时间】:2018-04-05 08:40:07
【问题描述】:
看来,我的问题与jsf 2 primefaces openDialog not working? 完全相同,但我使用的是 Spring Boot,但我没有faces-config.xml,但不知道如何配置。
我找到了https://github.com/code-not-found/jsf-primefaces/tree/master/jsf-primefaces-spring-boot,我认为这是 PrimeFaces (JSF) 和 Spring Boot 组合的一个很好的起点。
在那个项目中,我从PrimeFaces Showcase - Dialog Framework > Data + DFView.xhtml 添加了data.xhtml。
我只需要改变
PrimeFaces.current().dialog.openDynamic("selectCar", options, null);
到
RequestContext.getCurrentInstance().openDialog("selectCar", options, null);
org.joinfaces:jsf-spring-boot-parent:2.4.1 使用 PrimeFaces 6.1(不是最新的 6.2)
当我点击 Select Car 按钮时,我的 dfView.chooseCar 被调用,但是在
RequestContext.getCurrentInstance().openDialog("selectCar", options, null);
对话框未显示。
为简单起见,我的对话框仅包含静态文本。
编辑 1:
我只是尝试在 src/main/resources/WEB-INF/ 文件夹中创建带有内容的 faces-config.xml
<?xml version="1.0" encoding="UTF-8"?>
<faces-config xmlns="http://xmlns.jcp.org/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/web-facesconfig_2_2.xsd"
version="2.2">
<application>
<action-listener>org.primefaces.application.DialogActionListener</action-listener>
<navigation-handler>org.primefaces.application.DialogNavigationHandler</navigation-handler>
<view-handler>org.primefaces.application.DialogViewHandler</view-handler>
</application>
</faces-config>
但还是不行……
【问题讨论】:
-
你配置对话框框架了吗?请参阅 PF 文档!
-
很可能我没有,我现在正在检查...
-
@Kukeltje 链接的 SO 问题中到底有什么,配置动作侦听器、导航处理程序 + 视图处理程序...
标签: spring spring-boot jsf primefaces