0

由于某些原因,我的网络应用程序的路径似乎有问题。

我在 Eclipse 中的 WEB-INF 有以下路径:

Project
   --src
     -- main
        --webapp
          --WEB-INF
             --jsp
             --css

我使用 Spring、Hibernate 和 Maven 创建了一个项目。

但这例如不起作用,也不会从我的 jsp 页面加载样式:

<link href="css/style.css" rel="stylesheet" type="text/css">

web.xml 中的欢迎页面和错误页面也不起作用:

<welcome-file-list>
    <welcome-file>/students</welcome-file>
</welcome-file-list>
<error-page>
    <exception-type>java.lang.Exception</exception-type>
    <location>/WEB-INF/jsp/error.jsp</location>
</error-page>

错误页面的结果是在浏览器中显示“网站无法显示页面”消息。但是,如果我删除错误页面配置,我会得到一个堆栈跟踪,所以这意味着我的配置以某种方式被使用,但是在解释路径时出现了问题。

可能有什么问题?

4

1 回答 1

0

The welcome file is wrong. It is not a full path but the name of a file to look for in a directory if a directory is requested.

I don't see anything obviously wrong with the error page. Check the WAR/directory that is generated by Eclipse for the applciation to see if the error page is in the right place. Another thing to do is use a static file for the error page until you get it working to rule out any issues with the JSP.

于 2013-07-10T21:42:13.543 回答