1

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

2 Answers 2

3

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/

Sign up to request clarification or add additional context in comments.

Comments

2

Since Spring 4.3 @RequestAttribute annotation is a part of Spring MVC, so there is no need to create your own @RequestAttribute annotation

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.