views:

955

answers:

1

Hi,

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?

Thanks

+1  A: 

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.

Basically you create an @RequestAttribute annotation and then a custom WebArgumentResolver.

The blog entry has examples for @RequestAttribute and @SessionAttribute.

The svn directory with the examples is here.

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