laxmi
laxmi

Reputation: 107

How can i get the controller name in jsp?

I am developing a very small web application with spring mvc, In my jsp view that is returned by controller,I want to get the name of the controller.

One way is we can pass the name in ModelandView,But I don wan to do that. As I am sending a list of some other oblect.

I am looking for other best solution if any.

With Advance thanks, Laxmi

Upvotes: 5

Views: 1928

Answers (1)

Russell Gutierrez
Russell Gutierrez

Reputation: 1385

Here are some ways that came through my mind:

  1. Pass it in the request using request.setAttribute("name", "controller name");. Then in your jsp you can call ${ param.name }.

  2. Pass it in the session using session.setAttribute("name", "controller name");. Then in your jsp you can call ${ name }.

Upvotes: 1

Related Questions