带有可选参数的SpringMVC restful样式URL

时间:2014-04-04 07:47:23

标签: spring-mvc

现在我需要在restful中将一些不确定数量的参数传递给控制器​​,并且我正在做一切,如下所示:

@RequestMapping(value={"/list/{mcategory}/{scategory}/{pageNumber}.html",
                       "/list/{mcategory}.html",
                       "/list/{mcategory}/{pageNumber}.html")
public ModelAndView list(@PathVariable String mcategory, @PathVariable String scategory, @PathVariable Integer pageNumber)

但是你可以看到,那些血腥的映射太沉重了,无法阅读和理解,我想知道是否有更好的称呼?

更新

我很抱歉,一开始我提到了#34;我做得很好"以前我没有看到映射异常,所以我觉得一切都还好,但是当我测试这些映射时,它会抛出

"Mapped "{[/info/list/{mcategory}/{scategory}/{pageNumber}.html || /info/list/{mcategory}.html || /info/list/{mcategory}/{pageNumber}.html],methods=[],params=[],headers=[],consumes=[],produces=[],custom=[]}" onto public org.springframework.web.servlet.ModelAndView com.asc.modules.InformationModule.list(java.lang.String,java.lang.String,java.lang.Integer) throws java.io.UnsupportedEncodingException"

理解。

0 个答案:

没有答案
相关问题