Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Access Model attribute in scriptlet

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.

like image 855
Saket Avatar asked Nov 13 '11 14:11

Saket


Video Answer


1 Answers

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.

like image 58
BalusC Avatar answered Sep 26 '22 12:09

BalusC