spring mvc 注解@RequestAttribute 类似于@RequestParam [英] spring mvc annotation @RequestAttribute similar to @RequestParam

查看:33
本文介绍了spring mvc 注解@RequestAttribute 类似于@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 的注释控制器"的博客条目回答了您的问题.由于 Stackoverflow 不允许我创建直接链接,因此 Google 可以找到它.

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.

http://impala-extensions.googlecode.com/svn/trunk/impala-extension-mvc/src/org/impalaframework/extension/mvc/

这篇关于spring mvc 注解@RequestAttribute 类似于@RequestParam的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆