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

Popular posts from this blog

linux - Mailx and Gmail nss config dir -

c# - Is it possible to remove an existing registration from Autofac container builder? -

php - Mysql PK and FK char(36) vs int(10) -