一直没有办法拦截到url的请求,tomcat启动也没有看到Springmvc容器启动的任何说明。
所以就建立了一个普通的servlet工程,可以访问url。
再重新发布springmvc项目,访问url,就可以访问到url,并拦截。
但是出现下面的500 异常。所以需要jstl的jar包
org.springframework.web.util.NestedServletException: Handler processing failed; nested exception is java.lang.NoClassDefFoundError: javax/servlet/jsp/jstl/core/Config org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:1061) org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:942) org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:998) org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:890) javax.servlet.http.HttpServlet.service(HttpServlet.java:634) org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:875) javax.servlet.http.HttpServlet.service(HttpServlet.java:741) org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:200) org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107) org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:53)
Root Cause
java.lang.NoClassDefFoundError: javax/servlet/jsp/jstl/core/Config org.springframework.web.servlet.support.JstlUtils.exposeLocalizationContext(JstlUtils.java:102) org.springframework.web.servlet.view.JstlView.exposeHelpers(JstlView.java:137) org.springframework.web.servlet.view.InternalResourceView.renderMergedOutputModel(InternalResourceView.java:144) org.springframework.web.servlet.view.AbstractView.render(AbstractView.java:316) org.springframework.web.servlet.DispatcherServlet.render(DispatcherServlet.java:1370) org.springframework.web.servlet.DispatcherServlet.processDispatchResult(DispatcherServlet.java:1116) org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:1055) org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:942) org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:998) org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:890) javax.servlet.http.HttpServlet.service(HttpServlet.java:634) org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:875) javax.servlet.http.HttpServlet.service(HttpServlet.java:741) org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:200) org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107) org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:53)