Hi,

I need to display some variables on all JSPs of my application. These variables come from database, they are loaded at application startup and stored in a component that I called "iroiseContext". But I can't find the right way to push these variables to the view.

I am a newbie with Spring and, from what I understood, any variable you want to display in a JSP should be added by a controller to model map. So I created an interceptor that looks like this (not complete source) :

Code:
public class ViewInterceptor extends HandlerInterceptorAdapter {

	@Override
	public void postHandle(final HttpServletRequest request, final HttpServletResponse response, final Object handler, final ModelAndView mav) throws Exception {
		super.postHandle(request, response, handler, mav);		
		Parametre mentionsLegales = iroiseContext.getParametre(Parametre.MENTIONS_LEGALES);
		if (mentionsLegales == null) {
			throw new ParametreIntrouvableException(Parametre.MENTIONS_LEGALES);
		}
			
		Parametre aPropos = iroiseContext.getParametre(Parametre.A_PROPOS);
		if (aPropos == null) {
			throw new ParametreIntrouvableException(Parametre.A_PROPOS);
		}
			
		mav.getModelMap().addAttribute("infobulleAPropos", aPropos.getValeur());
		mav.getModelMap().addAttribute("infobulleMentionsLegales", mentionsLegales.getValeur());
	}
}
And I in my JSP I display the variables this way :

Code:
<a href="#" title="${infobulleAPropos}"><spring:message code="footer.libelle.aPropos"/></a>
This solution works well, but I have a little problem when the view is called with redirect.

For example, when calling this action :

Code:
<bean name="/web/logout"
	class="xxx.controller.authentification.LogoutController"
	parent="contextedController">
	<property name="viewName" value="redirect:/web/authentification" />
</bean>
the variables I added to model map in interceptor are added to GET url in the browser. Something like that :

Code:
http://localhost:8080/IroiseWeb/web/authentification?infobulleMentionsLegales=Mentions+l%C3%A9gales+pour+Iroise+Web&infobulleAPropos=A+propos+du+site+Iroise+Web
Not very nice ...

I guess that interceptor is called before redirect, so Spring has no choice pushing variables in GET url. So I thought about an interceptor for JSPs or views that would be called before view rendering and that would be a good place to push my variables. But I couldn't find such an interceptor in Spring ...

Is there one such interceptor ? Or am I wrong with the way I did this ?

Thanks in advance for any help

Olivier