jsp中读取properties文件

来源:互联网 发布:淘宝网b2c 编辑:程序博客网 时间:2024/05/16 05:25

现在有这样一个需求,需要的是将linux连接客户端嵌入到Web上,因此选择的是ShellInABox这个破烂玩意(GateOne,Wssh)。它开启服务要包含端口号,但是又害怕端口号冲突,因此需要把端口号写在配置文件中。以方便我们随时修改。

下面就直接上代码,自己看吧

重点的东西到了
文件:index.jsp

<%@ page import="java.util.ResourceBundle" %><%@ page contentType="text/html;charset=UTF-8" language="java" %><%    // 通过配置文件获取端口号,实在resources的相对路径下面    ResourceBundle res = ResourceBundle.getBundle("resource/resource");    // 服务的地址    String basePath = request.getScheme() + "://" + request.getServerName() + ":" + res.getString("shellinaboxport");%><div id="p" style="padding:10px;">    <iframe src="<%=basePath%>" width="100%" height="100%" scrolling="no" frameborder="0"></iframe></div><script>    $('#p').panel({        width: "100%",        title: "终端控制台",        fit: true    });</script>
原创粉丝点击