Reputation: 3824
<spring:message code="footer.copyriteText" arguments="NEEDS TO BE DYNAMIC" htmlEscape="false"/>
I need to replace NEEDS TO BE DYNAMIC
with Calendar.getInstance().get(Calendar.YEAR)
. How can I achieve this using EL?
Upvotes: 0
Views: 826
Reputation: 9655
If you don't want hardcode solution like BalusC said you can use this solution
Write custom jstl tag like c:set to execute constant path and return constant value then put the constant value to Page scope. This can be done via java Reflection.
Use the tag
<lib:getConstant path='java.util.Calendar.YEAR' var='v'/>
And
arguments='${v}`
This solution can work with all constants and you may want change constant values without changing jsp code.
Upvotes: 1