JSP中获取properties文件属性


<%@ page contentType="text/html;charset=UTF-8" import="java.util.ResourceBundle"%>
<%@ include file="/WEB-INF/views/include/taglib.jsp"%>
<%
    String path = request.getContextPath();
    // properties 配置文件名称
    ResourceBundle res = ResourceBundle.getBundle("test");
%>
<html>
<head>
<script>
    var name='<%=res.getString("name")%>';
</script>
</head>
<body>
</body>
</html>

test为properties文件 , test.properties  , name 为test中的一个属性名称


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM