在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>
答案 0 :(得分:1)
检查War / WEB-INF / libs中的库是否不存在,如果没有,则添加。