如何根据区域设置从属性文件中获取指令属性的值?
任务是根据区域设置有条件地包含 css 文件。为此,我将把与区域设置相关的 css 文件的路径放入属性文件中。我使用以下指令将 css 包含在页面中 -
<%@ include file="/path/to/my.css" %>
如何从属性文件中获取文件属性的值?
注意:我已经实现了 fmt taglib 并且工作正常。所以,我想做一些类似的事情 -
<%@ include file="<fmt:message key='page.css'/>" %>
但由于显而易见的原因,上述方法不起作用。
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 implemented 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.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
@include
是编译时(当要编译 JSP 时执行),而
是运行时(当要执行 JSP 时执行)。您想使用运行时包含
来代替。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.