【发布时间】:2018-05-08 14:05:00
【问题描述】:
在 intellij 2017.2.6 中,如果我使用 Glassfish 作为服务器创建一个 Web 项目,打开起始 index.xhtml 页面没有任何问题,但是当我使用 Tomcat 创建相同的页面时,我有一个 404。因为我使用 Intellij 进行 jsf 开发的新手我需要一些帮助。这就是我创建项目的方式。
这与我创建 Glassfish 的方式相同,除了取消选择 webServices (即使我检查它我也有同样的问题)。当 tomcat 启动时,它会打开页面 http://localhost:8080/index.xhtml,因为它在配置中声明。
这是 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">
<servlet>
<servlet-name>Faces Servlet</servlet-name>
<servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>Faces Servlet</servlet-name>
<url-pattern>*.xhtml</url-pattern>
</servlet-mapping>
</web-app>
【问题讨论】:
-
尝试在 pom.xml 中包含以下依赖
<dependency> <groupId>org.glassfish.web</groupId> <artifactId>el-impl</artifactId> <version>2.2</version> </dependency> -
我没有使用maven,这是一个基本的网络项目。
标签: tomcat jsf intellij-idea