単純な「Hello World」アプリケーションを使用してJava EEを学習しています。index.html
を使用してプログラムを実行するとうまくいきます。しかし、同じプログラムをindex.xhtml
で実行すると、「要求されたリソースが利用できません」という404エラーがスローされます。次のようにXHTMLではなくHTMLでないJava EE 404エラー
マイフォルダ構造は次のとおりです。私はindex.html
を使用してプログラムを実行すると
、私は次のURLを使用:http://localhost:8081/index.htmlを、そしてページがHello Worldのに表示されます。 index.xhtml
を使用して実行したとき、私はhttp://localhost:8081/example2/index.xhtmlとhttp://localhost:8081/index.xhtmlの両方を試しました。どちらも404エラーを出します。次のように
私の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>
私は複数のブラウザ(ChromeとFirefoxの)も試してみました。 XHTMLではなくHTMLではない404の理由は何ですか?
すべて表示web.xml – BrunoDM