How can I get the controller name in jsp?

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

One way is to pass the name to ModelandView, but I don't want to do this. As I am posting a list of some other considerations.

I am looking for another best solution, if any.

Thank you very much, Lakshmi.

+4
source share
1 answer

Here are a few ways that came to my mind:

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

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

+1
source

Source: https://habr.com/ru/post/1436518/


All Articles