【问题标题】:openDialog not working in Spring BootopenDialog 在 Spring Boot 中不起作用
【发布时间】: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


【解决方案1】:

这表明添加带有问题内容的 faces-config.xml 是解决方案,它应该在src/main/resources/META-INF/ 文件夹中。

我在使用 Spring Security 时遇到了其他问题,但使用这个答案解决了这个问题 - https://stackoverflow.com/a/31811446/384674

【讨论】:

    猜你喜欢
    • 2018-09-24
    • 2020-10-31
    • 2019-11-25
    • 2015-04-02
    • 1970-01-01
    • 1970-01-01
    • 2022-08-02
    • 2017-08-26
    • 2019-01-03
    相关资源
    最近更新 更多