17

I am using Spring MVC, and in my Controller, I am setting a standard model attribute using:

...
model.addAttribute("param", value);
...

Now, I wish to access this in a scriptlet (within a JSP). For example:

<% 
Object value = ***.get***("param"); 
... more java code...
%>

How can I do this?

NOTE: I understand it is a BAD IDEA to use scriptlets, but please bear with it for now.

Anish B.
  • 9,111
  • 3
  • 21
  • 41
Saket
  • 45,521
  • 12
  • 59
  • 79

1 Answers1

23

It's stored as a request attribute.

Object param = request.getAttribute("param");

Unrelated to the concrete problem, I suggest to ask a new question wherein you ask how to achieve the functional requirement without the need to fall back to legacy practices.

BalusC
  • 1,082,665
  • 372
  • 3,610
  • 3,555