el表达式在jsp中获取.properties配置文件中的配置常量

来源:互联网 发布:网易minecraft 知乎 编辑:程序博客网 时间:2024/06/02 15:21

1.监听java文件中

MerGuanConstants.SYSTEMPLATECREATE_USERID = ConfigConstant.getConstant("SYSTEMPLATECREATE_USERID");

2.常量java文件

public static String SYSTEMPLATECREATE_USERID = "";

3.configure.properties配置文件中配置

SYSTEMPLATECREATE_USERID = 12680

4.jsp文件中获取配置文件的常量

<%
String userId = MerGuanConstants.SYSTEMPLATECREATE_USERID;
request.setAttribute("userId",userId);
%>


<c:if test="${userIdString == userId }">
<div class="clearfix mt10">
<div class="fr">
<a class="btn Borange" id="createSysTemplateButton">新建模板</a>
</div>
</div>
 </c:if>

这样在test="${}"中就能获取到配置文件中的常量。

原创粉丝点击