How to debug servlet using Eclipse

前端 未结 2 636
闹比i
闹比i 2021-02-14 15:01

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?

相关标签:
2条回答
  • 2021-02-14 15:35

    Right-click on project -> Debug as -> Debug on server should do the trick

    0 讨论(0)
  • 2021-02-14 15:47

    First ensure that you're using "Eclipse IDE for Enterprise Java Developers", with the Enterprise in its name, and thus very definitely not just "Eclipse IDE for Java Developers".

    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.

    0 讨论(0)
提交回复
热议问题