spring xml这样配置
<!-- Bootstrap core CSS --> <link rel="stylesheet" type="text/css" href="<%=request.getContextPath()%>/static/plugins/bootstrap/css/bootstrap.min.css"> <!-- Custom styles for this template --> <link rel="stylesheet" type="text/css" href="<%=request.getContextPath()%>/static/css/signin.css" >页面JSP这样引用静态文件
还有一点,web.xml配置
<servlet> <servlet-name>springServlet</servlet-name> <servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class> <init-param> <param-name>contextConfigLocation</param-name> <param-value>classpath:spring/appContext_dispatcher.xml</param-value> </init-param> <load-on-startup>1</load-on-startup> </servlet> <servlet-mapping> <servlet-name>springServlet</servlet-name> <url-pattern>/</url-pattern> </servlet-mapping> <url-pattern>*.html</url-pattern> 开始时这样配置,访问css、js就会出现 404 <url-pattern>/</url-pattern> 修改成这样,就能访问的到了。
什么原因? 还没有查