在intellij 2017.2.6中,如果我创建了一个以Glassfish作为服务器的web项目,那么打开启动页面不会有任何问题
index.xhtml
页面,但当我用Tomcat创建相同的页面时,我有一个404。由于我对使用Intellij进行jsf开发还不熟悉,所以我想在这方面得到一些帮助。这就是我创建项目的方式。
这与我创建Glassfish的方式相同,只是没有选中webServices(即使我选中它,我也会遇到同样的问题)。当tomcat启动时,它会打开页面
http://localhost:8080/index.xhtml
正如配置中声明的那样。
这是网络。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>
人工制品