The task is to conditionally include a css file based on the Locale. To do this, I am going to put the path to the Locale dependent css file in the properties file. I am using the following directive to include the css in a page -
<%@ include file="/path/to/my.css" %>
How do I get the value of file attribute from properties file?
Note: I Have fmt taglib i开发者_StackOverflow中文版mplemented and working fine. So, I would like to do something like -
<%@ include file="<fmt:message key='page.css'/>" %>
But the above does not work for obvious reasons.
The @include
is compiletime (get executed when JSP is to be compiled) while <fmt:message>
is runtime (get executed when JSP is to be executed). You want to use the runtime include <jsp:include>
instead.
精彩评论