Spring MVC URL mapping in controller For dynamic URLs

本秂侑毒 提交于 2019-12-12 01:13:09

问题


I have a page with part of a URL that is dynamic e.g.

http://localhost:8080/myApp/myPageList.htm?recNo=107&recNo=-96&recNo=-24&recNo=-9&recNo=38&recNo=-21&recNo=-50&crimeRecNo=-110

The last part of the page recNo is a parameter passed to the page. However, the parameter value was encrypted. I would like to know how I can set the urlMapping in the controller. I will be posting the data and i will require a urlMapping to process this form.


回答1:


So based on your comments your request mapping should be

@RequestMapping("/myPageList.htm")

And the signature of your method something like

public WhateverType myPageList(@RequestParam("recNo") List<Integer> recNo, ...

assuming that recNo are integer values.




回答2:


Using SimpleUrlHandlerMapping (doc sample)might help.

Have a look at ControllerClassNameHandlerMapping here, as well



来源:https://stackoverflow.com/questions/16290808/spring-mvc-url-mapping-in-controller-for-dynamic-urls

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!