码迷,mamicode.com
首页 > Web开发 > 详细

JSP中获取properties文件属性

时间:2017-05-10 17:56:11      阅读:218      评论:0      收藏:0      [点我收藏+]

标签:view   color   source   utf-8   page   clu   ack   tty   style   

<%@ 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中的一个属性名称

JSP中获取properties文件属性

标签:view   color   source   utf-8   page   clu   ack   tty   style   

原文地址:http://www.cnblogs.com/lyhappy/p/6837043.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!