本文共 998 字,大约阅读时间需要 3 分钟。
以下为程序代码, 例如保存到 test.jsp 文件中,然后在IE中执行
http://....../test.jsp
将看不到任何输出,但是可以在后台resin的DOS窗口中看到输出的内容
//继承 JspWriter 类 class MyOut extends JspWriter { private HttpServletResponse response;//将输出语句都存入os中 public CharArrayWriter os;public MyOut() { super(0, false); os = new CharArrayWriter(); }public String getString() { return os.toString(); }public final void write(byte buf[], int off, int len) throws IOException { os.write( new String(buf, off, len) ); }public final void write(char buf[], int off, int len) throws IOException { os.write( new String(buf, off, len) ); } |
来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/374079/viewspace-131173/,如需转载,请注明出处,否则将追究法律责任。
转载于:http://blog.itpub.net/374079/viewspace-131173/