package com.lideng.servlet;import java.io.File;import java.io.FileInputStream;import java.io.IOException;import java.io.InputStream;import java.io.PrintWriter;import javax.servlet.ServletException;import javax.servlet.http.HttpServlet;impor
package com.lideng.servlet; import java.io.File; import java.io.FileInputStream; import java.io.IOException; import java.io.InputStream; import java.io.PrintWriter; import javax.servlet.ServletException; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; public class ReaderText extends HttpServlet { public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { InputStream is =new FileInputStream(new File("D:\\Notepad++\\change.log"));//根据自己的实际情况填写路径 int n=0; byte [] b=new byte[1024]; while((n=is.read(b))!=-1){ response.getWriter().write(new String(b)); } is.close(); } public void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { } }