In my Spring application I wish to add a configurable system message that can be displayed on every page. For example “The system is going down in 10 minutes”.
I need to store this value globally, but I can’t add any code to the controllers, as I don’t want to have to change every single one of them. I thought of using a @Service, but I don’t know how I can access this directly from the JSP.
I’m happy to use JSP scriptlet notation to get what I need. Any ideas?
Another idea would be to put the messages in the application scope?
Many people are not aware that there is one more scope other than request, session, and page.
At the servlet, set the attribute (request is a HttpServletRequest object passed to doGet/doPost method):
In your JSP file use something like this: