controller部分代码如下:
@RequestMapping(value = "/u/info/infoMonitorFromFriend" ) public String infoMonitorFromFriend( @RequestParam(required=false,defaultValue="",value="attid") int[] attid, //信息的属性额 1 原创 2 转发 7回复 @RequestParam(required=false,defaultValue="",value="keyid") int[] keyid, //关键词id 过滤 @RequestParam(required=false,defaultValue="",value="stat") int[] stat, // 状态 @RequestParam(required=false,defaultValue="",value="contentkey") String contentkey, // 内容包涵的词 @RequestParam(required=false,defaultValue="",value="userkey") String userkey, // 用户名包涵的内容 @RequestParam(value="page",defaultValue="1") Integer page, @RequestParam(value="pageSize",defaultValue="5") Integer pageSize, HttpServletRequest request, HttpServletResponse response, ModelMap model ) throws IOException {
当在Spring配置文件中用
<mvc:annotation-driven />
**/u/info/infoMonitorFromFriend?page=1&pageSize=5 这样的URL可以放到controller。
但是当我用,
org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerMapping
org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter
来配置,如下
<bean class="org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerMapping"> <property name="order" value="0" /> </bean> <bean class="org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter"> <property name="messageConverters"> <list> <bean class="org.springframework.http.converter.ByteArrayHttpMessageConverter" /> <bean class="org.springframework.http.converter.StringHttpMessageConverter" /> <bean class="org.springframework.http.converter.ResourceHttpMessageConverter" /> <bean class="org.springframework.http.converter.xml.SourceHttpMessageConverter" /> <bean class="org.springframework.http.converter.xml.XmlAwareFormHttpMessageConverter" /> <bean class="org.springframework.http.converter.xml.Jaxb2RootElementHttpMessageConverter" /> <bean class="org.springframework.http.converter.json.MappingJacksonHttpMessageConverter" > <property name="supportedMediaTypes"> <list> <value>text/html;charset=UTF-8</value> </list> </property> </bean> </list> </property> </bean>
**/u/info/infoMonitorFromFriend?page=1&pageSize=5 这样的URL就会返回404.
求解答~~~~~~~~~~~~~~~~~~~~~~~~~~~~`
相关推荐
SpringMVC@RequestMapping(重点)@RequestParam@PathVariable示例
主要介绍了SpringMvc @RequestParam 使用推荐使用包装类型代替包装类型,小编觉得挺不错的,现在分享给大家,也给大家做个参考。一起跟随小编过来看看吧
springmvc关于@requestMapping和@requestParam的使用,详细代码,独立可用无需修改。
主要介绍了SpringMVC注解@RequestParam方法原理解析,文中通过示例代码介绍的非常详细,对大家的学习或者工作具有一定的参考学习价值,需要的朋友可以参考下
下面小编就为大家带来一篇对SpringMVC的@RequestParam的解释。小编觉得挺不错的,现在就分享给大家,也给大家做个参考。一起跟随小编过来看看吧
SpringMVC @ModelAttribute应用SpringMVC @ModelAttribute应用
NULL 博文链接:https://zhaoshunxin.iteye.com/blog/1166266
弹簧 @Controller @RequestMapping @RequestParam,模型和ModelAndView Spring MVC实践
今天小编就为大家分享快速解决SpringMVC @RequestBody 用map接收请求参数的问题,具有很好的参考价值,希望对大家有所帮助。一起跟随小编过来看看吧
SpringMVC注解@RequestParam全面解析
public String method3(@RequestParam(value="username",defaultValue="",required=false) String username, @RequestParam(value="",defaultValue="",required=false)String password , HttpSession session ){...
主要介绍了SpringMVC @ControllerAdvice使用场景,文中通过示例代码介绍的非常详细,对大家的学习或者工作具有一定的参考学习价值,需要的朋友可以参考下
NULL 博文链接:https://jinnianshilongnian.iteye.com/blog/1718813
刚接触SpringMVC几天、代码肯定比不上大佬ε≡٩(๑>₃<)۶ ,手下留情,谢谢 ...@Controller、@RequestMapping、@requestParam用法及原理 _φ(❐_❐✧ 人丑就要多读书 不熬夜不追剧~( ̄▽ ̄)~*
springmvc 参数绑定例子,@RequestParam @CookieValue @PathVariable @ModelAttribute
NULL 博文链接:https://bijian1013.iteye.com/blog/2310240
主要介绍了详解SpringMVC @RequestBody接收Json对象字符串,小编觉得挺不错的,现在分享给大家,也给大家做个参考。一起跟随小编过来看看吧
此次上次的是springmvc官网中reference这个文件夹里的内容, 供大家方便查找下载。
java SpringMVC动态数据源的DataSource工具类,springmvc中配置数据源为工具类中的数据源,多线程使用不同数据源配置
Spring MVC下彻底解决@ResponseBody转义html特殊字符问题,解决包括尖角号(),单引号('),双引号("),按位与(&),反斜杠(\)。