url模式是:
<url-pattern>*.do</url-pattern>
我更改了web.file以添加
<url-pattern>/</url-pattern>
解决映射问题,而不是web.xml看起来像:
<display-name>Spring MVC Form Handling</display-name>
<servlet>
<servlet-name>spring</servlet-name>
<servlet-class>
org.springframework.web.servlet.DispatcherServlet
</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>spring</servlet-name>
<url-pattern>*.do</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>spring</servlet-name>
<url-pattern>/</url-pattern>
</servlet-mapping>
<welcome-file-list>
<welcome-file>index.jsp</welcome-file>
</welcome-file-list>
</web-app>
所以uri匹配问题已经解决但是新问题就像是
Web应用程序的设计和布局没有像之前那样显示。
现在已经坏了。请查看此链接上的图片:
http://postimg.org/image/cf80ko6in/
我想使用两种网址模式。如果我同时使用它们就没关系,会不会产生任何问题?
服务器日志:
WARN PageNotFound:1020 - No mapping found for HTTP request with URI [/HRportal/CSS/mystyle.css] in DispatcherServlet with name 'spring'
12:42:40,384 DEBUG DispatcherServlet:881 - Successfully completed request
12:42:40,387 DEBUG DispatcherServlet:766 - DispatcherServlet with name 'spring' processing GET request for [/HRportal/scripts/jquery-ui.js]
12:42:40,387 DEBUG DispatcherServlet:766 - DispatcherServlet with name 'spring' processing GET request for [/HRportal/CSS/Master.css]
12:42:40,388 WARN PageNotFound:1020 - No mapping found for HTTP request with URI [/HRportal/CSS/Master.css] in DispatcherServlet with name 'spring'
12:42:40,392 DEBUG DispatcherServlet:881 - Successfully completed request
12:42:40,390 DEBUG DispatcherServlet:766 - DispatcherServlet with name 'spring' processing GET request for [/HRportal/CSS/style.css]
12:42:40,388 WARN PageNotFound:1020 - No mapping found for HTTP request with URI [/HRportal/scripts/jquery-ui.js] in DispatcherServlet with name 'spring'
12:42:40,394 DEBUG DispatcherServlet:881 - Successfully completed request
12:42:40,394 WARN PageNotFound:1020 - No mapping found for HTTP request with URI [/HRportal/CSS/style.css] in DispatcherServlet with name 'spring'
12:42:40,394 DEBUG DispatcherServlet:881 - Successfully completed request
答案 0 :(得分:1)
在Spring DispatcherServlet
发送之前,请求首先必须与servlet容器匹配。
您的DispatcherServlet
似乎已映射到
<url-pattern>*.do</url-pattern>
这不能也不会匹配
/HRportal/upcomingLeaves.do/103
因为该路径不以.do
结尾。
只需将您的模式更改为
<url-pattern>/</url-pattern>
并具有默认的servlet映射。