如何使用Eclipse调试servlet [英] How to debug servlet using Eclipse

查看:351
本文介绍了如何使用Eclipse调试servlet的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有一个servlet,它可以在TomCat中运行。但是,我不知道如何在Eclipse(Java Standard版本)中进行调试。任何建议?

解决方案

确保您使用 Eclipse for Java EE ,而不是用于标准Java的Eclipse。



一旦确保/升级,在servlet代码中放置断点通常的方式,并在调试模式下运行服务器。右键单击Eclipse中的服务器,然后选择调试而不是开始(或单击错误按钮,而不是服务器视图按钮面板上的绿色箭头)。然后使用您喜欢的web浏览器在servlet上启动一个HTTP请求。当具有断点的特定代码行即将执行时,Eclipse将打开并集中调试面板。


Have a servlet and it can run inside TomCat. However, I am not sure how to debug it inside Eclipse(Java Standard version). Any suggestions?

解决方案

Ensure that you're using Eclipse for Java EE instead of Eclipse for standard Java.

Once ensured/upgraded, put breakpoints in the servlet code the usual way and run the server in debug modus. Rightclick the server in Eclipse and choose Debug instead of Start (or click the bug button instead of the green arrow on the button panel of the servers view). Then fire a HTTP request on the servlet using your favourite webbrowser. Eclipse will open and focus the debug panel when the particular code line with the breakpoint is about to be executed.

这篇关于如何使用Eclipse调试servlet的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆