How to Define a Property in xml files and use it in JSP
Files To Modify : build.xml / env.properties /a_config.xml / main.jsp
ServiceLocator.xml - has some stuff
build.xml----------------------------------
<filter token="omniture.sCodeJsFile" value="${omniture.sCodeJsFile}"/>
env.properties
----------------------------------
omniture.sCodeJsFile=s_code_dev.js
----------------------------------
omniture.sCodeJsFile=s_code_dev.js
aldous_css_oes_config.xml
----------------------------------
<omniture>
<sCodeJsFile>@omniture.sCodeJsFile@</sCodeJsFile>
</omniture>
----------------------------------
<omniture>
<sCodeJsFile>@omniture.sCodeJsFile@</sCodeJsFile>
</omniture>
main.jsp----------------------------------
<script type="text/javascript" src="${pageContext.servletContext.contextPath}/javascript/<tag:xmlConfigProperty key="omniture.sCodeJsFile"/>?@js_css.version@"></script>
<script type="text/javascript" src="${pageContext.servletContext.contextPath}/javascript/<tag:xmlConfigProperty key="omniture.sCodeJsFile"/>?@js_css.version@"></script>
<%@ taglib prefix="tag" tagdir="/WEB-INF/tags" %>
ServiceLocator.xml----------------------------------
<bean id="xmlConfiguration" class="org.apache.commons.configuration.XMLConfiguration">
<constructor-arg type="java.net.URL" ref="configurationURL"/>
<property name="reloadingStrategy" ref="reloadingStrategy"/>
</bean>
<bean id="xmlConfiguration" class="org.apache.commons.configuration.XMLConfiguration">
<constructor-arg type="java.net.URL" ref="configurationURL"/>
<property name="reloadingStrategy" ref="reloadingStrategy"/>
</bean>
Comments
Post a Comment