多语言展示
当前在线:205今日阅读:91今日分享:37

ubuntu下使用servlet,让tomcat做后台打印

在ubuntu下使用tomcat的时候,大家有没有发现,源程序中的system.out.println('不会被打印');这里教给大家一个方法,因为我菜鸟一直,大家见笑了!
工具/原料

ubuntu14.04,tomcat8,myeclipse2014

方法/步骤
1

首先大家写个小小的测试程序import java.io.IOException;import javax.servlet.ServletException;import javax.servlet.http.HttpServlet;import javax.servlet.http.HttpServletRequest;import javax.servlet.http.HttpServletResponse;public class HelloServlet extends HttpServlet{    @Override    protected void doGet(HttpServletRequest req, HttpServletResponse resp)            throws ServletException, IOException {                System.out.println('doGet');//我们是要把这个在后台输出的                //resp.getWriter().write('go');    }}

3

我就试了一个方法,在shell中使用./catalina.sh debug模式启动tomcat,你再去执行这个代码,后台就会显示结果了!大家试一试,也可能就是我电脑正常模式下不显示,如果真是,请大家告知,谢谢!

推荐信息