首页 > 解决方案 > jakarta 9.1 Facelets XHTML 页面命名空间指令

问题描述

我刚刚开始了一个基于 jakarta EE 9.1 和 jsf 的新 EE 项目。Jakarta EE 9 是新的,所以我从 Wildfly 25 开始非常简单。第一个测试结果是:“javax.el.PropertyNotFoundException: /test.xhtml @15,55 value="#{bean.input}": Target Unreachable,标识符'bean'解析为null”同时我将web.xml的命名空间指令更改为:

<web-app id="WebApp_ID" version="5.0"
   xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
   xmlns="https://jakarta.ee/xml/ns/jakartaee"
   xsi:schemaLocation="https://jakarta.ee/xml/ns/jakartaee 
                         https://jakarta.ee/xml/ns/jakartaee/web-app_5_0.xsd" >

对于 bean.xml 要:

<beans xmlns="https://jakarta.ee/xml/ns/jakartaee"
     xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
     xsi:schemaLocation="https://jakarta.ee/xml/ns/jakartaee 
                         https://jakarta.ee/xml/ns/jakartaee/beans_3_0.xsd"
     version="3.0" bean-discovery-mode="all">

对于 faces-config 来:

<faces-config version="3.0"
   xmlns="https://jakarta.ee/xml/ns/jakartaee"
   xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
   xsi:schemaLocation="https://jakarta.ee/xml/ns/jakartaee 
                   https://jakarta.ee/xml/ns/jakartaee/web-facesconfig_3_0.xsd">

我想到目前为止这是正确的。但我坚持使用带有声明的 test.xhtml:

<!DOCTYPE html>
<html lang="en"
    xmlns="http://www.w3.org/1999/xhtml"
    xmlns:f="http://xmlns.jcp.org/jsf/core"
    xmlns:h="http://xmlns.jcp.org/jsf/html">

我的简单测试仍然收到相同的错误消息,所以我怀疑,声明也应该是这样的:

<html lang="en" 
   xmlns="https://jakarta.ee/xml/ns/jakartaee"
   xmlns:f="https://jakarta.xxx.xxx/jsf/core" 
   xmlns:h="https://jakarta.xxx.xxx/jsf/html">

但我找不到正确的声明。你知道吗?

标签: jsfjakarta-eenamespacesxhtml

解决方案


推荐阅读