Spring access global value from JSP -
in spring application wish add configurable system message can displayed on every page. example "the system going down in 10 minutes".
i need store value globally, can't add code controllers, don't want have change every single 1 of them. thought of using @service, don't know how can access directly jsp.
i'm happy use jsp scriptlet notation need. ideas?
another idea put messages in application scope? many people not aware there 1 more scope other request, session, , page.
at servlet, set attribute (request httpservletrequest object passed doget/dopost method):
request.getsession().getservletcontext() .setattribute("my.sys.msg", "the system going down in 10 minutes.");
in jsp file use this:
<jsp:usebean id="my.sys.msg" scope="application" />
Comments
Post a Comment