简体   繁体   English

有什么方法可以使用Eclipse调试Web应用程序?

[英]Is there any way to debug web applications using Eclipse?

I am working on a web application using the Eclipse Java IDE. 我正在使用Eclipse Java IDE开发Web应用程序。

I am using Tomcat 6 as my servlet container. 我正在使用Tomcat 6作为我的servlet容器。

The tools available for Java, inculding Eclipse, seem to lack debugging capabilities for web applicatons (as compared to Visual Studio for the .NET platform). 可用于Java的工具(包括Eclipse)似乎缺少针对Web应用程序的调试功能(与.NET平台的Visual Studio相比)。

How can I debug my web app using Eclipse? 如何使用Eclipse调试Web应用程序?

在调试模式下运行tomcat(Java选项-Xdebug -Xnoagent -Djava.compiler=NONE -Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=8000 ),然后在Eclipse中使用远程调试(调试配置->远程Java Aplication)并通过已配置的端口(例如本例中的8000)连接到服务器。

If you want to debug your web application, set breakpoints where desired and run Tomcat on debug mode. 如果要调试Web应用程序,请在所需的位置设置断点,然后在调试模式下运行Tomcat。 If you logged your exceptions or placed INFO / DEBUG messages, you can view them on Console (if ConsoleAppender is used). 如果您记录了异常或放置了INFO / DEBUG消息,则可以在Console上查看它们(如果使用ConsoleAppender )。

The essential thing is that your application runs on debug mode. 重要的是您的应用程序在调试模式下运行。 For browser side debugging (as @Thomas said), there's tools like Chrome Debugger (for Google Chrome), Firebug (for Firefox) and Firebug Lite (for other browsers). 对于浏览器端调试(如@Thomas所说),有诸如Chrome Debugger(对于Google Chrome), Firebug (对于Firefox)和Firebug Lite(对于其他浏览器)之类的工具。

您可以在代码中添加断点,并以调试模式部署应用程序。

Eclipse has a console window where you can see the error messages generated. Eclipse有一个控制台窗口,您可以在其中查看生成的错误消息。 For the web there are an add ons or built on the browser like firebug for Firefox and Google-chrome developers-tools. 对于网络,有一个附加组件或构建在浏览器上,例如用于Firefox的firebug和Google-chrome开发人员工具。 Try too look on it. 尝试一下。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM