【问题标题】:The project does not work with servlet 4.0 and jsf 2.3该项目不适用于 servlet 4.0 和 jsf 2.3
【发布时间】:2018-12-30 06:47:17
【问题描述】:

我有一个在 intellij IDEA 中使用 CDI、JSF、BeanValidation、Servlet-api 的小型 Java EE 项目。我的服务器是 glassfish 5.0.0,我读到它实现了 servlet 4.0、cdi 2.0、jsf 2.3 和 bean 验证 2.0。

我有以下 xml 配置:

1.web.xml:

      <?xml version="1.0" encoding="UTF-8"?>
        <web-app 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-app_3_1.xsd"
                 version="3.1">
    <!--Configurations-->
        </web-app>

2.faces-config.xml:

    <faces-config version="2.2" 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">

</faces-config>

3.beans.xml:

    <?xml version="1.0" encoding="UTF-8"?>

<beans xmlns="http://java.sun.com/xml/ns/javaee"
       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
       xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/beans_2_0.xsd">

</beans>

现在一切都很好,但是当我尝试将 servlet 3.1 更改为 servlet 4.0、jsf 2.2 到 jsf 2.3 时,我使用表达式语言的所有 jsf 页面都不起作用,例如 &lt;h:commandButton action='#{bean.doSomething}' /&gt; 不要触发事件

我做错了什么?对不起我的英语不好。

更新。

我正在将我的项目移动到 maven,重新更新了所有库,一切正常,所以我认为问题出在错误的配置或库中。

【问题讨论】:

    标签: java jsf servlet-4


    【解决方案1】:

    如果有人感兴趣,这个问题很可能是由知道bug in Mojarra 引起的。在 Glassfish 5 中将默认的 2.3.2 javax.faces.jar 更新到至少 2.3.3 后,JSF 将再次按预期工作。

    【讨论】:

      猜你喜欢
      • 2018-10-10
      • 2017-10-11
      • 1970-01-01
      • 2016-01-04
      • 1970-01-01
      • 2012-05-04
      • 2013-10-24
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多