I’m struggling to make something veeery simple work. Everything I really need to do is to write a property value in a view, i.e.:
<!DOCTYPE html>
<head>
...
<base href="${properties.config.baseurl}" />
...
</head>
<body>
...
</body>
</html>
My Spring MVC configuration (relevant bit):
<bean id="properties" class="org.springframework.beans.factory.config.PropertiesFactoryBean">
<property name="locations">
<list><value>/WEB-INF/config.properties</value></list>
</property>
</bean>
<bean class="org.springframework.web.servlet.view.InternalResourceViewResolver">
<property name="prefix" value="/WEB-INF/jsp/" />
<property name="suffix" value=".jsp" />
<property name="exposedContextBeanNames">
<list><value>properties</value></list>
</property>
</bean>
/WEB-INF/config.properties file:
config.baseurl = http://localhost:8080/
The view doesn’t display anything at all (i.e. <base href="" />), can anyone explain to me why?
Thank you.
You need to use
rather than
Otherwise it will try to navigate
config.baseurllike a bean path, rather than as a string literal.