Java Spring Framework - 无法运行 XHTML 文件

java spring framework - cannot run xhtml file

提问人:witcha 提问时间:11/20/2022 更新时间:11/20/2022 访问量:27

问:

enter image description here

当我尝试运行 XHTML 文件时,我收到“源服务器未找到目标资源的当前表示形式或不愿意披露存在”错误。

_01_Named.java类

package com.emirguler.cdi;


import lombok.*;

import javax.enterprise.context.ApplicationScoped;
import javax.inject.Named;

@Data
@Getter @Setter
@AllArgsConstructor
@NoArgsConstructor
@Builder

//cdi ==> bean
@Named(value = "namedtuto")
@ApplicationScoped
public class _01_Named {

    private Long namedId;
    private String namedDdata = "Hello named cdi bean";
}

XHTML 文件

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
        "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:h="http://xmlns.jcp.org/jsf/html"
      xmlns:ui="http://xmlns.jcp.org/jsf/facelets"
      xmlns:f="http://xmlns.jcp.org/jsf/core">
<h:head>
    <title> Named</title>
</h:head>
<h:body>

    <h:form>
        <h:outputText>value ="#{namedtuto.namedDdata}"</h:outputText>
    </h:form>
</h:body>
</html>

enter image description here

第一次创建项目后,我被定向到 Hello Servlet 页面,没有任何错误,所以我想与 Tomcat 无关。我不知道我该如何解决这个问题。

java tomcat xhtml spring-framework-beans

评论


答: 暂无答案