maven - Wildfly 没有看到 .xhtml 扩展名
问题描述
我正在使用 jdk 11 和 wildfly 18。创建动态 Web 项目后,我将其转换为 maven 项目。然后我在 pom.xml 的下面添加,我正在处理这个项目,然后我没有找到 404。WebContent 有一个 NewFile.xhtml。然后我在 wildfly 中运行该项目,但它不起作用。实际上,我的项目在转换为 maven 项目之前正在运行。转换后,项目不起作用。Url 扩展名:http://localhost:8080/JSFWeek02/welcome.xhtml。在我运行项目后自动 url 扩展是:http://localhost:8080/JSFWeek02/faces/welcome.xhtml。我不知道为什么我会出错。如果你能帮助我,我会很高兴的。
web.xml
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>JSFWeek01</groupId>
<artifactId>JSFWeek01</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>war</packaging>
<build>
<sourceDirectory>src</sourceDirectory>
<plugins>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.1</version>
<configuration>
<release>11</release>
</configuration>
</plugin>
<plugin>
<artifactId>maven-war-plugin</artifactId>
<version>3.2.3</version>
<configuration>
<warSourceDirectory>WebContent</warSourceDirectory>
</configuration>
</plugin>
</plugins>
</build>
<dependencies>
<!-- https://mvnrepository.com/artifact/com.sun.faces/jsf-impl -->
<dependency>
<groupId>com.sun.faces</groupId>
<artifactId>jsf-impl</artifactId>
<version>2.2.20</version>
</dependency>
<!-- https://mvnrepository.com/artifact/com.sun.faces/jsf-api -->
<dependency>
<groupId>com.sun.faces</groupId>
<artifactId>jsf-api</artifactId>
<version>2.2.20</version>
</dependency>
</dependencies>
</project>
新文件.xhtml
<?xml version="1.0" encoding="ISO-8859-1" ?>
<!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://java.sun.com/jsf/html">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" />
<title>Shen</title>
</head>
<body>
I am <h:outputText value="Kerem"/>
</body>
</html>
解决方案
推荐阅读
- javascript - Tensforflow.JS:十进制训练输出中的损失值
- javascript - 为什么索引是来自渲染列表的类在 React Hooks 中使用 map 函数?
- python - win32api.GetAsyncKeyState(0x01) 按下时返回 -32768 而不是 1
- javascript - 仅使用年份(没有月份或日期)与 Google 时间轴图表
- react-native - 如何在反应导航中“前进”?
- javascript - JavaScript 的打字效果:“键入”所有文本后如何删除光标
- flutter - Flutter 应用程序可在 android 上运行,但在桌面上失败
- php - 如何从数据库中的“登录用户”中选择数据到图表
- excel - 带有可搜索列表的用户窗体组合框不使用 keyDown 选择第一个项目
- swift - 模式无法匹配“SKError”类型的值