LoginSignup
0
0

More than 5 years have passed since last update.

Servletのwebapp フォルダ下に配置したcssやjsファイルが読めないときの原因

Last updated at Posted at 2015-08-20

web.xml のservlet-mappingが、以下のようになっていると、すべてのリクエストがサーブレットへ振り分けられてしまう。これが原因。

web.xml
<servlet-mapping>
    <servlet-name>MyServlet</servlet-name>
    <url-pattern>/*</url-pattern>
</servlet-mapping>

サーブレットのパスが決まっているのならば、以下のように修正する

web.xml
<servlet-mapping>
    <servlet-name>MyServlet</servlet-name>
    <url-pattern>/myservlet</url-pattern>
</servlet-mapping>
0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0