Spring MVC - JSP - Place to Store Environment Specific Constants
Posted
by jboyd
on Stack Overflow
See other posts from Stack Overflow
or by jboyd
Published on 2010-06-15T16:08:35Z
Indexed on
2010/06/15
16:12 UTC
Read the original article
Hit count: 269
Where in the Spring-MVC/JSP application would you store things that need to be accessed by both the controllers and views such as environment specific base_url's, application ids to be used in javascript and so on?
I've tried creating an application scoped bean and then at the top of my JSPs, but that doesn't seem to be working.
<!-- Environment -->
<bean id="myEnv" class="com.myapp.MyAppEnvironment" scope="application">
<property name="baseUrl" value="http://localhost:8080/myapp/"/>
<property name="videoPlayerId" value="234346565"/>
</bean>
And using it in the following manner
<jsp:useBean id="myEnv" scope="application" type="com.myapp.MyAppEnvironment"/>
© Stack Overflow or respective owner