0

我有一个非常简单的 web 应用程序,我正在尝试使用flot javascript 库绘制图形。我的 JSP 文件以这种方式导入所需的 *.js 文件,如下所示。

相对于WEB-INF/pages/hello.jsp的hello.jsp文件,相关.js文件的scripts目录在../../scripts(即直接在ROOT下)

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
    <title>Flot Examples: Categories</title>
    <script src="http://code.jquery.com/jquery-latest.min.js"
        type="text/javascript"></script>
    <script language="javascript" type="text/javascript" src="../../scripts/jquery.flot.js"></script>
    <script type="text/javascript">

    $(function() {
     //code draw the graph 
    </script>
</head>
<body>
        <h2>Categories</h2>
        <div id="placeholder" style="width:788px;height:400px"></div>
        <h3>End of Page</h3>
</body>
</html>

目录结构如下 root@domU-12-31-39-13-C5-F5:/usr/local/jetty/webapps# tree

.
|-- README.TXT
`-- ROOT
    |-- META-INF
    |   |-- MANIFEST.MF
    |   `-- maven
    |       `-- com.mkyong.common
    |           `-- SpringMVC
    |               |-- pom.properties
    |               `-- pom.xml
    |-- scripts
    |   |-- jquery.colorhelpers.js
    |   |-- jquery.flot.time.js
    |   |-- jquery.flot.time.min.js
    |   |-- jquery.js
    |   |-- jquery.min.js
    |   |-- LICENSE.txt
    |   |-- Makefile
    |   |-- NEWS.md
    |   |-- PLUGINS.md
    |   `-- README.md
    `-- WEB-INF
        |-- classes
        |   `-- com
        |       `-- mkyong
        |           `-- common
        |               `-- controller
        |                   `-- HelloController.class
        |-- hello.html
        |-- lib
        |   |-- aopalliance-1.0.jar
        |   |-- commons-logging-1.1.1.jar
        |   |-- spring-aop-3.0.5.RELEASE.jar
        |   |-- spring-asm-3.0.5.RELEASE.jar
        |   |-- spring-web-3.0.5.RELEASE.jar
        |   `-- spring-webmvc-3.0.5.RELEASE.jar
        |-- mvc-dispatcher-servlet.xml
        |-- pages
        |   |-- hello.html
        |   `-- hello.jsp
        `-- web.xml

观察

  1. 使用 firefox eclipse,我可以看到浏览器正在请求GET http://ec2-184-73-14-57.compute-1.amazonaws.com:5809/scripts/jquery.flot.js但因此无法找到它失败并出现 404 Not found
  2. 将脚本目录移动到 WEB-INF 下并更改相对路径也会导致相同的错误。
  3. 当引用为 /scripts/*.js 时,部署在 tomcat 中的类似应用程序正在从 ROOT 目录中选择 .js 文件
  4. 无法使用绝对路径引用 js 文件,当我这样做时,它会尝试将绝对路径附加到http://ec2-184-73-14-57.compute-1.amazonaws.com:5809/并尝试获取它..因此导致404错误

以前没用过Jetty,这个问题是Jetty特有的吗?什么是导入 javascript 文件的更好方法。请指教

这是webapp启动后的转储

 2013-04-12 19:08:04.829:INFO:oejs.ServerConnector:main: Started ServerConnector@3ae0e5b7{HTTP/1.1}{0.0.0.0:5809}
    org.eclipse.jetty.server.Server@6a7ef378 - STARTING
     += qtp578065504{STARTED,10<=10<=200,i=8,q=0} - STARTED
     |   +- 12 qtp578065504-12-selector-0 RUNNABLE @ sun.nio.ch.EPollArrayWrapper.epollWait(Native Method)
     |   +- 13 qtp578065504-13-acceptor-0-ServerConnector@3ae0e5b7{HTTP/1.1}{0.0.0.0:5809} RUNNABLE @ sun.nio.ch.ServerSocketChannelImpl.accept0(Native Method)
     |   +- 14 qtp578065504-14 TIMED_WAITING @ sun.misc.Unsafe.park(Native Method) IDLE
     |   +- 15 qtp578065504-15 TIMED_WAITING @ sun.misc.Unsafe.park(Native Method) IDLE
     |   +- 16 qtp578065504-16 TIMED_WAITING @ sun.misc.Unsafe.park(Native Method) IDLE
     |   +- 17 qtp578065504-17 TIMED_WAITING @ sun.misc.Unsafe.park(Native Method) IDLE
     |   +- 18 qtp578065504-18 TIMED_WAITING @ sun.misc.Unsafe.park(Native Method) IDLE
     |   +- 19 qtp578065504-19 TIMED_WAITING @ sun.misc.Unsafe.park(Native Method) IDLE
     |   +- 20 qtp578065504-20 TIMED_WAITING @ sun.misc.Unsafe.park(Native Method) IDLE
     |   +- 21 qtp578065504-21 TIMED_WAITING @ sun.misc.Unsafe.park(Native Method) IDLE
     += org.eclipse.jetty.util.thread.ScheduledExecutorScheduler@7c8b3bd8 - STARTED
     += org.eclipse.jetty.server.handler.HandlerCollection@582b0e7b - STARTED
     |   += org.eclipse.jetty.server.handler.ContextHandlerCollection@7e999262 - STARTED
     |   |   +~ org.eclipse.jetty.jmx.MBeanContainer@3a55b9b
     |   |   += o.e.j.w.WebAppContext@2f7e1b09{/,file:/usr/local/osmosix/jetty/webapps/ROOT/,AVAILABLE}{/ROOT} - STARTED
     |   |       += org.eclipse.jetty.server.session.SessionHandler@8a6bf88 - STARTED
     |   |       |   += org.eclipse.jetty.server.session.HashSessionManager@3620f49e - STARTED
     |   |       |   += org.eclipse.jetty.security.ConstraintSecurityHandler@5daa3e56 - STARTED
     |   |       |   |   +- org.eclipse.jetty.security.DefaultAuthenticatorFactory@12959ac0
     |   |       |   |   += org.eclipse.jetty.servlet.ServletHandler@72140bcb - STARTED
     |   |       |   |   |   += default@5c13d641==org.eclipse.jetty.servlet.DefaultServlet,0,false - STARTED
     |   |       |   |   |   |   +- maxCacheSize=256000000
     |   |       |   |   |   |   +- etags=true
     |   |       |   |   |   |   +- dirAllowed=true
     |   |       |   |   |   |   +- gzip=true
     |   |       |   |   |   |   +- maxCachedFileSize=200000000
     |   |       |   |   |   |   +- redirectWelcome=false
     |   |       |   |   |   |   +- acceptRanges=true
     |   |       |   |   |   |   +- welcomeServlets=false
     |   |       |   |   |   |   +- aliases=false
     |   |       |   |   |   |   +- useFileMappedBuffer=true
     |   |       |   |   |   |   +- maxCachedFiles=2048
     |   |       |   |   |   +- [/]=>default
     |   |       |   |   |   += jsp@19c47==org.apache.jasper.servlet.JspServlet,0,false - STARTED
     |   |       |   |   |   |   +- logVerbosityLevel=DEBUG
     |   |       |   |   |   |   +- fork=false
     |   |       |   |   |   |   +- scratchdir=/tmp/jetty-0.0.0.0-5809-ROOT-_-any-/jsp
     |   |       |   |   |   |   +- xpoweredBy=false
     |   |       |   |   |   +- [*.jsp, *.jspf, *.jspx, *.xsp, *.JSP, *.JSPF, *.JSPX, *.XSP]=>jsp
     |   |       |   |   |   += mvc-dispatcher@f974527a==org.springframework.web.servlet.DispatcherServlet,1,true - STARTED
     |   |       |   |   |   +- [/]=>mvc-dispatcher
     |   |       |   |   |   +~ org.eclipse.jetty.jmx.MBeanContainer@3a55b9b
     |   |       |   |   +~ org.eclipse.jetty.jmx.MBeanContainer@3a55b9b
     |   |       |   |   +~ HashLoginService[Test Realm] - STARTED
     |   |       |   |   +- org.eclipse.jetty.security.DefaultIdentityService@77df3248
     |   |       |   |   +- org.eclipse.jetty.security.authentication.BasicAuthenticator@652520bb
     |   |       |   |   |
     |   |       |   |   +> HashLoginService[Test Realm] - STARTED
     |   |       |   |   +> org.eclipse.jetty.security.DefaultIdentityService@77df3248
     |   |       |   |   +> org.eclipse.jetty.security.authentication.BasicAuthenticator@652520bb
     |   |       |   |   +> []
     |   |       |   |   +> /={TRACE={RoleInfo,F,C[]}}
     |   |       |   +~ org.eclipse.jetty.jmx.MBeanContainer@3a55b9b
     |   |       += org.eclipse.jetty.servlet.ErrorPageErrorHandler@4ec93402 - STARTED
     |   |       |   +~ org.eclipse.jetty.jmx.MBeanContainer@3a55b9b
     |   |       +~ org.eclipse.jetty.jmx.MBeanContainer@3a55b9b
     |   |       |
     |   |       +> WebAppClassLoader=Spring Web MVC Application@bf6140f
     |   |       |   +- file:/usr/local/osmosix/jetty/webapps/ROOT/WEB-INF/classes/
     |   |       |   +- file:/usr/local/osmosix/jetty/webapps/ROOT/WEB-INF/lib/spring-aop-3.0.5.RELEASE.jar
     |   |       |   +- file:/usr/local/osmosix/jetty/webapps/ROOT/WEB-INF/lib/spring-beans-3.0.5.RELEASE.jar
     |   |       |   +- file:/usr/local/osmosix/jetty/webapps/ROOT/WEB-INF/lib/spring-expression-3.0.5.RELEASE.jar
     |   |       |   +- file:/usr/local/osmosix/jetty/webapps/ROOT/WEB-INF/lib/aopalliance-1.0.jar
     |   |       |   +- file:/usr/local/osmosix/jetty/webapps/ROOT/WEB-INF/lib/spring-context-support-3.0.5.RELEASE.jar
     |   |       |   +- file:/usr/local/osmosix/jetty/webapps/ROOT/WEB-INF/lib/spring-web-3.0.5.RELEASE.jar
     |   |       |   +- file:/usr/local/osmosix/jetty/webapps/ROOT/WEB-INF/lib/spring-core-3.0.5.RELEASE.jar
     |   |       |   +- file:/usr/local/osmosix/jetty/webapps/ROOT/WEB-INF/lib/spring-webmvc-3.0.5.RELEASE.jar
     |   |       |   +- file:/usr/local/osmosix/jetty/webapps/ROOT/WEB-INF/lib/spring-asm-3.0.5.RELEASE.jar
     |   |       |   +- file:/usr/local/osmosix/jetty/webapps/ROOT/WEB-INF/lib/spring-context-3.0.5.RELEASE.jar
     |   |       |   +- file:/usr/local/osmosix/jetty/webapps/ROOT/WEB-INF/lib/commons-logging-1.1.1.jar
     |   |       |   +- startJarLoader@518cb416
     |   |       |       +- file:/usr/local/osmosix/jetty/lib/jetty-xml-9.0.0.v20130308.jar
     |   |       |       +- file:/usr/local/osmosix/jetty/lib/servlet-api-3.0.jar
     |   |       |       +- file:/usr/local/osmosix/jetty/lib/jetty-http-9.0.0.v20130308.jar
     |   |       |       +- file:/usr/local/osmosix/jetty/lib/jetty-continuation-9.0.0.v20130308.jar
     |   |       |       +- file:/usr/local/osmosix/jetty/lib/jetty-server-9.0.0.v20130308.jar
     |   |       |       +- file:/usr/local/osmosix/jetty/lib/jetty-security-9.0.0.v20130308.jar
     |   |       |       +- file:/usr/local/osmosix/jetty/lib/jetty-servlet-9.0.0.v20130308.jar
     |   |       |       +- file:/usr/local/osmosix/jetty/lib/jetty-webapp-9.0.0.v20130308.jar
     |   |       |       +- file:/usr/local/osmosix/jetty/lib/jetty-deploy-9.0.0.v20130308.jar
     |   |       |       +- file:/usr/local/osmosix/jetty/lib/jetty-client-9.0.0.v20130308.jar
     |   |       |       +- file:/usr/local/osmosix/jetty/lib/jetty-jmx-9.0.0.v20130308.jar
     |   |       |       +- file:/usr/local/osmosix/jetty/lib/jsp/com.sun.el-2.2.0.v201108011116.jar
     |   |       |       +- file:/usr/local/osmosix/jetty/lib/jsp/javax.el-2.2.0.v201108011116.jar
     |   |       |       +- file:/usr/local/osmosix/jetty/lib/jsp/javax.servlet.jsp.jstl-1.2.0.v201105211821.jar
     |   |       |       +- file:/usr/local/osmosix/jetty/lib/jsp/javax.servlet.jsp-2.2.0.v201112011158.jar
     |   |       |       +- file:/usr/local/osmosix/jetty/lib/jsp/org.apache.jasper.glassfish-2.2.2.v201112011158.jar
     |   |       |       +- file:/usr/local/osmosix/jetty/lib/jsp/org.apache.taglibs.standard.glassfish-1.2.0.v201112081803.jar
     |   |       |       +- file:/usr/local/osmosix/jetty/lib/jsp/org.eclipse.jdt.core-3.7.1.jar
     |   |       |       +- file:/usr/local/osmosix/jetty/resources/
     |   |       |       +- file:/usr/local/osmosix/jetty/lib/websocket/websocket-api-9.0.0.v20130308.jar
     |   |       |       +- file:/usr/local/osmosix/jetty/lib/websocket/websocket-common-9.0.0.v20130308.jar
     |   |       |       +- file:/usr/local/osmosix/jetty/lib/websocket/websocket-server-9.0.0.v20130308.jar
     |   |       |       +- file:/usr/local/osmosix/jetty/lib/websocket/websocket-servlet-9.0.0.v20130308.jar
     |   |       |       +- file:/usr/local/osmosix/jetty/lib/jetty-util-9.0.0.v20130308.jar
     |   |       |       +- file:/usr/local/osmosix/jetty/lib/jetty-io-9.0.0.v20130308.jar
     |   |       |       +- sun.misc.Launcher$AppClassLoader@e9576fd
     |   |       |           +- file:/usr/local/osmosix/jetty/start.jar
     |   |       |           +- sun.misc.Launcher$ExtClassLoader@76b6e385
     |   |       +> contextConfigLocation=/WEB-INF/mvc-dispatcher-servlet.xml
     |   |       +> javax.servlet.context.tempdir=/tmp/jetty-0.0.0.0-5809-ROOT-_-any-
     |   |       +> org.eclipse.jetty.server.webapp.ContainerIncludeJarPattern=.*/servlet-api-[^/]*\.jar$
     |   |       +> org.springframework.web.context.support.ServletContextScope=org.springframework.web.context.support.ServletContextScope@392e8f9
     |   |       +> org.springframework.web.context.WebApplicationContext.ROOT=Root WebApplicationContext: startup date [Fri Apr 12 19:08:03 UTC 2013]; root of context hierarchy
     |   |       +> org.springframework.web.servlet.FrameworkServlet.CONTEXT.mvc-dispatcher=WebApplicationContext for namespace 'mvc-dispatcher-servlet': startup date [Fri Apr 12 19:08:04 UTC 2013]; parent: Root WebApplicationContext
     |   += org.eclipse.jetty.server.handler.DefaultHandler@423dc560 - STARTED
     |   |   +~ org.eclipse.jetty.jmx.MBeanContainer@3a55b9b
     |   += org.eclipse.jetty.server.handler.RequestLogHandler@70a6302b - STARTED
     |   |   += org.eclipse.jetty.server.NCSARequestLog@6dbe7935 - STARTED
     |   |   +~ org.eclipse.jetty.jmx.MBeanContainer@3a55b9b
     |   +~ org.eclipse.jetty.jmx.MBeanContainer@3a55b9b
     += HashLoginService[Test Realm] - STARTED
     +- org.eclipse.jetty.jmx.MBeanContainer@3a55b9b
     |   +- org.eclipse.jetty.security.ConstraintSecurityHandler@5daa3e56=org.eclipse.jetty.security:context=ROOT,type=constraintsecurityhandler,id=0
     |   +- org.eclipse.jetty.security.DefaultAuthenticatorFactory@12959ac0=org.eclipse.jetty.security:context=ROOT,type=defaultauthenticatorfactory,id=0
     |   +- qtp578065504{STARTED,10<=10<=200,i=8,q=0}=org.eclipse.jetty.util.thread:type=queuedthreadpool,id=0
     |   +- [*.jsp, *.jspf, *.jspx, *.xsp, *.JSP, *.JSPF, *.JSPX, *.XSP]=>jsp=org.eclipse.jetty.servlet:context=ROOT,type=servletmapping,name=jsp,id=0
     |   +- org.eclipse.jetty.server.Server@6a7ef378=org.eclipse.jetty.server:type=server,id=0
     |   +- org.eclipse.jetty.deploy.providers.WebAppProvider@3e9985a5=org.eclipse.jetty.deploy.providers:type=webappprovider,id=0
     |   +- HttpConnectionFactory@33192410{HTTP/1.1}=org.eclipse.jetty.server:context=HTTP/1.1@3ae0e5b7,type=httpconnectionfactory,id=0
     |   +- default@5c13d641==org.eclipse.jetty.servlet.DefaultServlet,0,false=org.eclipse.jetty.servlet:context=ROOT,type=servletholder,name=default,id=0
     |   +- org.eclipse.jetty.server.handler.DefaultHandler@423dc560=org.eclipse.jetty.server.handler:type=defaulthandler,id=0
     |   +- [/]=>default=org.eclipse.jetty.servlet:context=ROOT,type=servletmapping,name=default,id=0
     |   +- org.eclipse.jetty.server.handler.RequestLogHandler@70a6302b=org.eclipse.jetty.server.handler:type=requestloghandler,id=0
     |   +- org.eclipse.jetty.servlet.ServletHandler@72140bcb=org.eclipse.jetty.servlet:context=ROOT,type=servlethandler,id=0
     |   +- org.eclipse.jetty.server.handler.ContextHandlerCollection@7e999262=org.eclipse.jetty.server.handler:type=contexthandlercollection,id=0
     |   +- org.eclipse.jetty.server.session.HashSessionIdManager@434d3d4f=org.eclipse.jetty.server.session:type=hashsessionidmanager,id=0
     |   +- org.eclipse.jetty.jmx.MBeanContainer@3a55b9b=org.eclipse.jetty.jmx:type=mbeancontainer,id=0
     |   +- HashLoginService[Test Realm]=org.eclipse.jetty.security:type=hashloginservice,id=0
     |   +- jsp@19c47==org.apache.jasper.servlet.JspServlet,0,false=org.eclipse.jetty.servlet:context=ROOT,type=servletholder,name=jsp,id=0
     |   +- o.e.j.w.WebAppContext@2f7e1b09{/,file:/usr/local/osmosix/jetty/webapps/ROOT/,AVAILABLE}{/ROOT}=org.eclipse.jetty.webapp:context=ROOT,type=webappcontext,id=0
     |   +- HttpConfiguration@3636d04a{32768,8192/8192,https://:5809,[]}=org.eclipse.jetty.server:context=HTTP/1.1@3ae0e5b7,type=httpconfiguration,id=0
     |   +- org.eclipse.jetty.security.DefaultIdentityService@77df3248=org.eclipse.jetty.security:context=ROOT,type=defaultidentityservice,id=0
     |   +- org.eclipse.jetty.io.ArrayByteBufferPool@bba4cd7=org.eclipse.jetty.io:context=HTTP/1.1@3ae0e5b7,type=arraybytebufferpool,id=0
     |   +- sun.nio.ch.ServerSocketChannelImpl[/0:0:0:0:0:0:0:0:5809]=sun.nio.ch:context=HTTP/1.1@3ae0e5b7,type=serversocketchannelimpl,id=0
     |   +- org.eclipse.jetty.security.authentication.BasicAuthenticator@652520bb=org.eclipse.jetty.security.authentication:context=ROOT,type=basicauthenticator,id=0
     |   +- mvc-dispatcher@f974527a==org.springframework.web.servlet.DispatcherServlet,1,true=org.eclipse.jetty.servlet:context=ROOT,type=servletholder,name=mvc-dispatcher,id=0
     |   +- org.eclipse.jetty.server.session.SessionHandler@8a6bf88=org.eclipse.jetty.server.session:context=ROOT,type=sessionhandler,id=0
     |   +- [/]=>mvc-dispatcher=org.eclipse.jetty.servlet:context=ROOT,type=servletmapping,name=mvc-dispatcher,id=0
     |   +- org.eclipse.jetty.server.handler.HandlerCollection@582b0e7b=org.eclipse.jetty.server.handler:type=handlercollection,id=0
     |   +- org.eclipse.jetty.deploy.DeploymentManager@76bb5e95=org.eclipse.jetty.deploy:type=deploymentmanager,id=0
     |   +- org.eclipse.jetty.server.session.HashSessionManager@3620f49e=org.eclipse.jetty.server.session:context=ROOT,type=hashsessionmanager,id=0
     |   +- ServerConnector@3ae0e5b7{HTTP/1.1}{0.0.0.0:5809}=org.eclipse.jetty.server:context=HTTP/1.1@3ae0e5b7,type=serverconnector,id=0
     |   +- org.eclipse.jetty.util.log.Log@3daf611c=org.eclipse.jetty.util.log:type=log,id=0
     |   +- org.eclipse.jetty.server.ServerConnector$ServerConnectorManager@3b195903=org.eclipse.jetty.server:context=HTTP/1.1@3ae0e5b7,type=serverconnector$serverconnectormanager,id=0
     |   +- org.eclipse.jetty.servlet.ErrorPageErrorHandler@4ec93402=org.eclipse.jetty.servlet:context=ROOT,type=errorpageerrorhandler,id=0
     |   +- org.eclipse.jetty.server.NCSARequestLog@6dbe7935=org.eclipse.jetty.server:type=ncsarequestlog,id=0
     |   +- org.eclipse.jetty.util.thread.ScheduledExecutorScheduler@7c8b3bd8=org.eclipse.jetty.util.thread:type=scheduledexecutorscheduler,id=0
     +- org.eclipse.jetty.util.log.Log@3daf611c
     += ServerConnector@3ae0e5b7{HTTP/1.1}{0.0.0.0:5809} - STARTED
     |   +~ org.eclipse.jetty.server.Server@6a7ef378 - STARTING
     |   +~ qtp578065504{STARTED,10<=10<=200,i=8,q=0} - STARTED
     |   +~ org.eclipse.jetty.util.thread.ScheduledExecutorScheduler@7c8b3bd8 - STARTED
     |   +- org.eclipse.jetty.io.ArrayByteBufferPool@bba4cd7
     |   += HttpConnectionFactory@33192410{HTTP/1.1} - STARTED
     |   |   +- HttpConfiguration@3636d04a{32768,8192/8192,https://:5809,[]}
     |   |   +~ org.eclipse.jetty.jmx.MBeanContainer@3a55b9b
     |   += org.eclipse.jetty.server.ServerConnector$ServerConnectorManager@3b195903 - STARTED
     |   |   +- org.eclipse.jetty.io.SelectorManager$ManagedSelector@6436babd keys=0 selected=0 id=0
     |   |       +- org.eclipse.jetty.io.SelectorManager$ManagedSelector.select(SelectorManager.java:443)
     |   |       +- sun.nio.ch.EPollSelectorImpl@27f703ba keys=0
     |   +~ org.eclipse.jetty.jmx.MBeanContainer@3a55b9b
     |   +- sun.nio.ch.ServerSocketChannelImpl[/0:0:0:0:0:0:0:0:5809]
     += org.eclipse.jetty.deploy.DeploymentManager@76bb5e95 - STARTED
     |   +~ org.eclipse.jetty.deploy.providers.WebAppProvider@3e9985a5 - STARTED
     |   +~ org.eclipse.jetty.jmx.MBeanContainer@3a55b9b
     += org.eclipse.jetty.server.session.HashSessionIdManager@434d3d4f - STARTED
     |
     +> startJarLoader@518cb416
         +- file:/usr/local/osmosix/jetty/lib/jetty-xml-9.0.0.v20130308.jar
         +- file:/usr/local/osmosix/jetty/lib/servlet-api-3.0.jar
         +- file:/usr/local/osmosix/jetty/lib/jetty-http-9.0.0.v20130308.jar
         +- file:/usr/local/osmosix/jetty/lib/jetty-continuation-9.0.0.v20130308.jar
         +- file:/usr/local/osmosix/jetty/lib/jetty-server-9.0.0.v20130308.jar
         +- file:/usr/local/osmosix/jetty/lib/jetty-security-9.0.0.v20130308.jar
         +- file:/usr/local/osmosix/jetty/lib/jetty-servlet-9.0.0.v20130308.jar
         +- file:/usr/local/osmosix/jetty/lib/jetty-webapp-9.0.0.v20130308.jar
         +- file:/usr/local/osmosix/jetty/lib/jetty-deploy-9.0.0.v20130308.jar
         +- file:/usr/local/osmosix/jetty/lib/jetty-client-9.0.0.v20130308.jar
         +- file:/usr/local/osmosix/jetty/lib/jetty-jmx-9.0.0.v20130308.jar
         +- file:/usr/local/osmosix/jetty/lib/jsp/com.sun.el-2.2.0.v201108011116.jar
         +- file:/usr/local/osmosix/jetty/lib/jsp/javax.el-2.2.0.v201108011116.jar
         +- file:/usr/local/osmosix/jetty/lib/jsp/javax.servlet.jsp.jstl-1.2.0.v201105211821.jar
         +- file:/usr/local/osmosix/jetty/lib/jsp/javax.servlet.jsp-2.2.0.v201112011158.jar
         +- file:/usr/local/osmosix/jetty/lib/jsp/org.apache.jasper.glassfish-2.2.2.v201112011158.jar
         +- file:/usr/local/osmosix/jetty/lib/jsp/org.apache.taglibs.standard.glassfish-1.2.0.v201112081803.jar
         +- file:/usr/local/osmosix/jetty/lib/jsp/org.eclipse.jdt.core-3.7.1.jar
         +- file:/usr/local/osmosix/jetty/resources/
         +- file:/usr/local/osmosix/jetty/lib/websocket/websocket-api-9.0.0.v20130308.jar
         +- file:/usr/local/osmosix/jetty/lib/websocket/websocket-common-9.0.0.v20130308.jar
         +- file:/usr/local/osmosix/jetty/lib/websocket/websocket-server-9.0.0.v20130308.jar
         +- file:/usr/local/osmosix/jetty/lib/websocket/websocket-servlet-9.0.0.v20130308.jar
         +- file:/usr/local/osmosix/jetty/lib/jetty-util-9.0.0.v20130308.jar
         +- file:/usr/local/osmosix/jetty/lib/jetty-io-9.0.0.v20130308.jar
         +- sun.misc.Launcher$AppClassLoader@e9576fd
             +- file:/usr/local/osmosix/jetty/start.jar
             +- sun.misc.Launcher$ExtClassLoader@76b6e385
4

1 回答 1

0

你的servlet-mapping设置不好。

命名的 servletmvc-dispatcher设置在url-patternof "/",也称为 servlet 规范默认 servlet 路径规范。Web 容器本身提供的允许它提供静态内容(如 css 和 javascript 文件)的东西。

你的mvc-dispatcherat"/"这意味着 Default Servlet 本身不能提供静态内容。

这也意味着它org.springframework.web.servlet.DispatcherServlet现在负责提供来自 WebApp 的所有内容。这是一个非典型的servlet-mapping,我怀疑这是 spring DispatcherServlet 的作用。

考虑使用基于后缀的 servlet 路径规范"*.html"或基于前缀的 servlet 路径规范"/*" (这在 Servlet 规范的第 12 节中有概述)

于 2013-04-12T20:40:07.343 回答