类似@RequestParam Spring MVC的注解@RequestAttribute [英] spring mvc annotation @RequestAttribute similar to @RequestParam
问题描述
我想添加类似于@RequestParam注释,虽然有它从请求属性拉出值,而不是请求参数...
I would like add an annotation similar to @RequestParam, though have it pull the values from the request attribute rather than the request param...
有一个例子或解释如何创建自己的注解,这和需要,以及处理器/粘合剂?
Is there an example or explanation how to create my own annotation for this and the handler / binder needed as well?
感谢
推荐答案
标题为扩展Spring MVC的注解控制器的博客中回答你的问题。谷歌,找到它,因为#1不会让我创造的直接联系。
The blog entry with the title "Extending Spring MVC's annotation controller" answers your question. Google it to find it since Stackoverflow won't let me create the direct link.
基本上你创建一个@RequestAttribute注释,然后自定义WebArgumentResolver。
Basically you create an @RequestAttribute annotation and then a custom WebArgumentResolver.
博客条目有@RequestAttribute和@SessionAttribute例子。
The blog entry has examples for @RequestAttribute and @SessionAttribute.
与示例SVN目录是在这里。
The svn directory with the examples is here.
<一个href=\"http://impala-extensions.google$c$c.com/svn/trunk/impala-extension-mvc/src/org/impalaframework/extension/mvc/\" rel=\"nofollow\">http://impala-extensions.google$c$c.com/svn/trunk/impala-extension-mvc/src/org/impalaframework/extension/mvc/
这篇关于类似@RequestParam Spring MVC的注解@RequestAttribute的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!