TA的每日心情 | 开心 2021-3-12 23:18 |
---|
签到天数: 2 天 [LV.1]初来乍到
|
<%@ page language="java" contentType="text/HTML; charset=gb2312"
pageEncoding="gb2312"%>
<%@page import="java.io.*" %>
<html>
<head> <title>XX网上购物商城</title> </head>
<body>
<%
ServletContext sc = config.getServletContext();
try
{
InputStream in = sc.getResourceAsStream("/WEB-INF/123456.txt");
BufferedReader br = new BufferedReader(new InputStreamReader(new BufferedInputStream(in)));
String str;
out.println("123456.txt内容:");
while((str=br.readLine())!=null) {
out.println(str+"<br />");
}
br.close();
in.close();
out.flush();
}catch(Exception e){
e.printStackTrace();
}
//String path = sc.getResource("WEB-INF/web.xml");
out.println("本网页的绝对路径为:" + sc.getResource("/WEB-INF/123456.txt"));
%>
</body>
</html>
源码下载:http://file.javaxxz.com/2014/10/2/054244078.zip |
|