spring mvc 的一个问题

链接1:测试1--class

链接2:
测试2-class

[code="java"]
@Component
@RequestMapping("/")
public class CatalogBaseController extends BaseMultiActionController {

@Autowired
ICatalogBaseService catalogBaseService;


/**
 * @param catalogBaseService the catalogBaseService to set
 */
public void setCatalogBaseService(ICatalogBaseService catalogBaseService) {
    this.catalogBaseService = catalogBaseService;
}
//class-1-0-0-index-1-1.html 须将urlrewrite.xml 中的相同规则注释,否则只会执行urlrewrite.xml的规则
@RequestMapping(value="/class-{ppcid}-{pcid}-{cid}-index-{type}-{p}.html",method=RequestMethod.GET)  
public ModelAndView base(CatalogBaseModel cb,HttpServletRequest request,HttpServletResponse response){
    Map<String,Object> map=new HashMap<String,Object>();
    System.out.println(" cb.getPpcid() = "+cb.getPpcid());
    return toView("orderflow/cart/cart", map);
}
//class-1-4-30-index-1-0-0-0-0-0-0-0-0-1.html
@RequestMapping(value="/class-{ppcid}-{pcid}-{cid}-{index}-{type}-{priceid}-{lower}-{high}-{bid}-{order}-{sortType}-{province}-{city}-{p}.html",method=RequestMethod.GET)  
public ModelAndView more(CatalogBaseModel cb,HttpServletRequest request,HttpServletResponse response){
    Map<String,Object> map=new HashMap<String,Object>();
    System.out.println(" cb.getPpcid() = "+cb.getPpcid());
    return toView("orderflow/cart/cart", map);
}

}[/code]
为何链接1能正常访问
链接2就报错了,
[code="java"]
org.springframework.web.util.NestedServletException: Request processing failed; nested exception is org.springframework.validation.BindException: org.springframework.validation.BeanPropertyBindingResult: 1 errors
Field error in object 'catalogBaseModel' on field 'type': rejected value [1-0-0-0-0-0-0-0-0]; codes [typeMismatch.catalogBaseModel.type,typeMismatch.type,typeMismatch.int,typeMismatch]; arguments [org.springframework.context.support.DefaultMessageSourceResolvable: codes [catalogBaseModel.type,type]; arguments []; default message [type]]; default message [Failed to convert property value of type 'java.lang.String' to required type 'int' for property 'type'; nested exception is java.lang.NumberFormatException: For input string: "1-0-0-0-0-0-0-0-0"]
at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:894)
at org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:778)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:621)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:722)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:304)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
at org.tuckey.web.filters.urlrewrite.UrlRewriteFilter.doFilter(UrlRewriteFilter.java:575)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
at com.cwc.filter.SetCharacterEncodingFilter.doFilter(SetCharacterEncodingFilter.java:126)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)

at com.bbf.common.filter.InitFilter.doFilter(InitFilter.java:30)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:88)
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:76)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243)

at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:240)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:164)
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:498)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:164)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:100)

at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:562)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:394)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:243)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:188)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:166)

at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:302)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603)
at java.lang.Thread.run(Thread.java:722)

Caused by: org.springframework.validation.BindException: org.springframework.validation.BeanPropertyBindingResult: 1 errors
Field error in object 'catalogBaseModel' on field 'type': rejected value [1-0-0-0-0-0-0-0-0]; codes [typeMismatch.catalogBaseModel.type,typeMismatch.type,typeMismatch.int,typeMismatch]; arguments [org.springframework.context.support.DefaultMessageSourceResolvable: codes [catalogBaseModel.type,type]; arguments []; default message [type]]; default message [Failed to convert property value of type 'java.lang.String' to required type 'int' for property 'type'; nested exception is java.lang.NumberFormatException: For input string: "1-0-0-0-0-0-0-0-0"]
at org.springframework.web.method.annotation.ModelAttributeMethodProcessor.resolveArgument(ModelAttributeMethodProcessor.java:110)
at org.springframework.web.method.support.HandlerMethodArgumentResolverComposite.resolveArgument(HandlerMethodArgumentResolverComposite.java:75)
at org.springframework.web.method.support.InvocableHandlerMethod.getMethodArgumentValues(InvocableHandlerMethod.java:162)
at org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:123)
at org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:100)

at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandlerMethod(RequestMappingHandlerAdapter.java:604)
at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:565)
at org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java:80)
at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:923)
at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:852)

at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:882)
... 33 more

[2012-12-10 17:43:40,235] [ERROR] SetCharacterEncodingFilter.doFilter throwable.toString() = org.springframework.web.util.NestedServletException: Request processing failed; nested exception is org.springframework.validation.BindException: org.springframework.validation.BeanPropertyBindingResult: 1 errors
Field error in object 'catalogBaseModel' on field 'type': rejected value [1-0-0-0-0-0-0-0-0]; codes [typeMismatch.catalogBaseModel.type,typeMismatch.type,typeMismatch.int,typeMismatch]; arguments [org.springframework.context.support.DefaultMessageSourceResolvable: codes [catalogBaseModel.type,type]; arguments []; default message [type]]; default message [Failed to convert property value of type 'java.lang.String' to required type 'int' for property 'type'; nested exception is java.lang.NumberFormatException: For input string: "1-0-0-0-0-0-0-0-0"]
[2012-12-10 17:43:40] [ERROR] SetCharacterEncodingFilter.doFilter throwable.toString() = org.springframework.web.util.NestedServletException: Request processing failed; nested exception is org.springframework.validation.BindException: org.springframework.validation.BeanPropertyBindingResult: 1 errors
Field error in object 'catalogBaseModel' on field 'type': rejected value [1-0-0-0-0-0-0-0-0]; codes [typeMismatch.catalogBaseModel.type,typeMismatch.type,typeMismatch.int,typeMismatch]; arguments [org.springframework.context.support.DefaultMessageSourceResolvable: codes [catalogBaseModel.type,type]; arguments []; default message [type]]; default message [Failed to convert property value of type 'java.lang.String' to required type 'int' for property 'type'; nested exception is java.lang.NumberFormatException: For input string: "1-0-0-0-0-0-0-0-0"]
[2012-12-10 17:43:40,235] [ERROR] SetCharacterEncodingFilter.doFilter begin
[2012-12-10 17:43:40] [ERROR] SetCharacterEncodingFilter.doFilter begin
[2012-12-10 17:43:40,235] [ERROR] SetCharacterEncodingFilter.doFilter:org.springframework.web.util.NestedServletException: Request processing failed; nested exception is org.springframework.validation.BindException: org.springframework.validation.BeanPropertyBindingResult: 1 errors
Field error in object 'catalogBaseModel' on field 'type': rejected value [1-0-0-0-0-0-0-0-0]; codes [typeMismatch.catalogBaseModel.type,typeMismatch.type,typeMismatch.int,typeMismatch]; arguments [org.springframework.context.support.DefaultMessageSourceResolvable: codes [catalogBaseModel.type,type]; arguments []; default message [type]]; default message [Failed to convert property value of type 'java.lang.String' to required type 'int' for property 'type'; nested exception is java.lang.NumberFormatException: For input string: "1-0-0-0-0-0-0-0-0"]
[2012-12-10 17:43:40] [ERROR] SetCharacterEncodingFilter.doFilter:org.springframework.web.util.NestedServletException: Request processing failed; nested exception is org.springframework.validation.BindException: org.springframework.validation.BeanPropertyBindingResult: 1 errors
Field error in object 'catalogBaseModel' on field 'type': rejected value [1-0-0-0-0-0-0-0-0]; codes [typeMismatch.catalogBaseModel.type,typeMismatch.type,typeMismatch.int,typeMismatch]; arguments [org.springframework.context.support.DefaultMessageSourceResolvable: codes [catalogBaseModel.type,type]; arguments []; default message [type]]; default message [Failed to convert property value of type 'java.lang.String' to required type 'int' for property 'type'; nested exception is java.lang.NumberFormatException: For input string: "1-0-0-0-0-0-0-0-0"]
[2012-12-10 17:43:40,236] [ERROR] Referer:http://www.800pharm.com/shop/monitor/moni.jsp
[2012-12-10 17:43:40] [ERROR] Referer:http://www.800pharm.com/shop/monitor/moni.jsp
[2012-12-10 17:43:40,236] [ERROR] Current URL:/shop/class-1-4-30-index-1-0-0-0-0-0-0-0-0-1.html
[2012-12-10 17:43:40] [ERROR] Current URL:/shop/class-1-4-30-index-1-0-0-0-0-0-0-0-0-1.html
[2012-12-10 17:43:40,236] [ERROR] Visitor:Mozilla/5.0 (Windows NT 6.1; rv:17.0) Gecko/20100101 Firefox/17.0
[2012-12-10 17:43:40] [ERROR] Visitor:Mozilla/5.0 (Windows NT 6.1; rv:17.0) Gecko/20100101 Firefox/17.0
[2012-12-10 17:43:40,236] [ERROR] Parameters:
[2012-12-10 17:43:40] [ERROR] Parameters:
[2012-12-10 17:43:40,236] [ERROR] IP:127.0.0.1
[2012-12-10 17:43:40] [ERROR] IP:127.0.0.1
[2012-12-10 17:43:40,236] [ERROR] SetCharacterEncodingFilter-----error-Request processing failed; nested exception is org.springframework.validation.BindException: org.springframework.validation.BeanPropertyBindingResult: 1 errors
Field error in object 'catalogBaseModel' on field 'type': rejected value [1-0-0-0-0-0-0-0-0]; codes [typeMismatch.catalogBaseModel.type,typeMismatch.type,typeMismatch.int,typeMismatch]; arguments [org.springframework.context.support.DefaultMessageSourceResolvable: codes [catalogBaseModel.type,type]; arguments []; default message [type]]; default message [Failed to convert property value of type 'java.lang.String' to required type 'int' for property 'type'; nested exception is java.lang.NumberFormatException: For input string: "1-0-0-0-0-0-0-0-0"]
[2012-12-10 17:43:40] [ERROR] SetCharacterEncodingFilter-----error-Request processing failed; nested exception is org.springframework.validation.BindException: org.springframework.validation.BeanPropertyBindingResult: 1 errors
Field error in object 'catalogBaseModel' on field 'type': rejected value [1-0-0-0-0-0-0-0-0]; codes [typeMismatch.catalogBaseModel.type,typeMismatch.type,typeMismatch.int,typeMismatch]; arguments [org.springframework.context.support.DefaultMessageSourceResolvable: codes [catalogBaseModel.type,type]; arguments []; default message [type]]; default message [Failed to convert property value of type 'java.lang.String' to required type 'int' for property 'type'; nested exception is java.lang.NumberFormatException: For input string: "1-0-0-0-0-0-0-0-0"]
[2012-12-10 17:43:40,237] [ERROR] SetCharacterEncodingFilter.doFilter end
[2012-12-10 17:43:40] [ERROR] SetCharacterEncodingFilter.doFilter end
org.springframework.web.util.NestedServletException: Request processing failed; nested exception is org.springframework.validation.BindException: org.springframework.validation.BeanPropertyBindingResult: 1 errors
Field error in object 'catalogBaseModel' on field 'type': rejected value [1-0-0-0-0-0-0-0-0]; codes [typeMismatch.catalogBaseModel.type,typeMismatch.type,typeMismatch.int,typeMismatch]; arguments [org.springframework.context.support.DefaultMessageSourceResolvable: codes [catalogBaseModel.type,type]; arguments []; default message [type]]; default message [Failed to convert property value of type 'java.lang.String' to required type 'int' for property 'type'; nested exception is java.lang.NumberFormatException: For input string: "1-0-0-0-0-0-0-0-0"]
at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:894)
at org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:778)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:621)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:722)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:304)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
at org.tuckey.web.filters.urlrewrite.UrlRewriteFilter.doFilter(UrlRewriteFilter.java:575)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
at com.cwc.filter.SetCharacterEncodingFilter.doFilter(SetCharacterEncodingFilter.java:126)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)

at com.bbf.common.filter.InitFilter.doFilter(InitFilter.java:30)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)

at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:88)
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:76)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:240)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:164)
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:498)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:164)

at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:100)
at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:562)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118)

at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:394)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:243)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:188)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:166)
at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:302)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603)
at java.lang.Thread.run(Thread.java:722)

Caused by: org.springframework.validation.BindException: org.springframework.validation.BeanPropertyBindingResult: 1 errors
Field error in object 'catalogBaseModel' on field 'type': rejected value [1-0-0-0-0-0-0-0-0]; codes [typeMismatch.catalogBaseModel.type,typeMismatch.type,typeMismatch.int,typeMismatch]; arguments [org.springframework.context.support.DefaultMessageSourceResolvable: codes [catalogBaseModel.type,type]; arguments []; default message [type]]; default message [Failed to convert property value of type 'java.lang.String' to required type 'int' for property 'type'; nested exception is java.lang.NumberFormatException: For input string: "1-0-0-0-0-0-0-0-0"]
at org.springframework.web.method.annotation.ModelAttributeMethodProcessor.resolveArgument(ModelAttributeMethodProcessor.java:110)
at org.springframework.web.method.support.HandlerMethodArgumentResolverComposite.resolveArgument(HandlerMethodArgumentResolverComposite.java:75)
at org.springframework.web.method.support.InvocableHandlerMethod.getMethodArgumentValues(InvocableHandlerMethod.java:162)
at org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:123)

at org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:100)
at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandlerMethod(RequestMappingHandlerAdapter.java:604)
at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:565)
at org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java:80)

at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:923)
at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:852)
at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:882)
... 33 more

javax.servlet.ServletException: SetCharacterEncodingFilter.doFilter IOException:org.springframework.web.util.NestedServletException: Request processing failed; nested exception is org.springframework.validation.BindException: org.springframework.validation.BeanPropertyBindingResult: 1 errors
Field error in object 'catalogBaseModel' on field 'type': rejected value [1-0-0-0-0-0-0-0-0]; codes [typeMismatch.catalogBaseModel.type,typeMismatch.type,typeMismatch.int,typeMismatch]; arguments [org.springframework.context.support.DefaultMessageSourceResolvable: codes [catalogBaseModel.type,type]; arguments []; default message [type]]; default message [Failed to convert property value of type 'java.lang.String' to required type 'int' for property 'type'; nested exception is java.lang.NumberFormatException: For input string: "1-0-0-0-0-0-0-0-0"]
at com.cwc.filter.SetCharacterEncodingFilter.processException(SetCharacterEncodingFilter.java:186)
at com.cwc.filter.SetCharacterEncodingFilter.doFilter(SetCharacterEncodingFilter.java:131)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)

at com.bbf.common.filter.InitFilter.doFilter(InitFilter.java:30)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:88)
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:76)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:240)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:164)
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:498)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:164)

at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:100)
at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:562)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:394)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:243)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:188)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:166)
at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:302)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110)

at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603)

at java.lang.Thread.run(Thread.java:722)

[/code]
有没有大神能帮忙解惑

hanfengliu99
hanfengliu99 最后的解决方法: @RequestMapping(value={"/class-{ppcid:\\d+}-{pcid:\\d+}-{cid:\\d+}-index-{type:\\d+}-{pageNo:\\d+}.html", "/class-{ppcid:\\d+}-{pcid:\\d+}-{cid:\\d+}-index-{type:\\d+}-{priceid:\\d+}-{lower:\\d+}-{high:\\d+}-{bid:\\d+}-{order:\\d+}-{sortType:\\d+}-{province:\\d+}-{city:\\d+}-{pageNo:\\d+}.html" },method=RequestMethod.GET) public ModelAndView more(@ModelAttribute("cb") CatalogBaseModel cb,HttpServletRequest request,HttpServletResponse response){ return toView("orderflow/cart/cart", map); }
7 年多之前 回复

2个回答

匹配问题,请参考[url]http://jinnianshilongnian.iteye.com/blog/1684403[/url],可以考虑使用正则表达式匹配

1、此处需要注意的是【4.14中提到的最长匹配优先】,Ant风格的模式请参考4.14。
2、URI模板模式映射是{userId},不能指定模板变量的数据类型,如是数字还是字符串;

@RequestMapping(value="/class-{ppcid}-{pcid}-{cid}-index-{type:\d+}-{priceid:\d+}-{lower:\d+}-{high:\d+}-{bid:\d+}-{order:\d+}-{sortType:\d+}-{province:\d+}-{city:\d+}-{p:\d+}.html",method=RequestMethod.GET)

@RequestMapping(value="/class-{ppcid}-{pcid}-{cid}-index-{type:\d+}-{p:\d+}.html",method=RequestMethod.GET)

[code="java"]
//class-1-4-30-index-1-0-0-0-0-0-0-0-0-1.html

@RequestMapping(value="/class-{ppcid}-{pcid}-{cid}-{index}-{type}-{priceid}-{lower}-{high}-{bid}-{order}-{sortType}-{province}-{city}-{p}.html",method=RequestMethod.GET)

public ModelAndView more(CatalogBaseModel cb,HttpServletRequest request,HttpServletResponse response){

}
[/code]
{index} 多了大括号。

这样看着多乱,写错了也很难看出来。

Csdn user default icon
上传中...
上传图片
插入图片
抄袭、复制答案,以达到刷声望分或其他目的的行为,在CSDN问答是严格禁止的,一经发现立刻封号。是时候展现真正的技术了!
立即提问
相关内容推荐