0

I have a Spring MVC 4.2.x application. I want to use Freemarker as my view resolver. I currently have .jsp's and in them, at the base of all url's is this code:

src="${pageContext.request.contextPath}/images/TrademarkedLogo.png" 

My question is how do I do this for freemarker? I know I can add that to the model every time I call a controller, but I obviously don't want to do that if I don't have to. There is the setSharedVariable(name,value) in the configuration, but in spring, you cant set 2 variables in a context.xml.

Any Ideas?

mmaceachran
  • 3,178
  • 7
  • 53
  • 102
  • do you want something like [this](http://stackoverflow.com/questions/1249205/how-to-get-the-request-context-in-a-freemaker-template-in-spring)? – logee Jan 15 '16 at 02:47

1 Answers1

0

I have a couple of broad suggestions... you could perhaps put the value that's meant to go there in a properties file and get it out of that - there is a related question here. Or you could do things the AOP way and add @AfterAdvice which adds that property to the model, so you never have to declare it manually but it just gets added automatically after each call to a controller method.

Community
  • 1
  • 1
james_s_tayler
  • 1,823
  • 1
  • 15
  • 20