How to debug JS running in Tomcat

已回答

I have some web pages that are generated from JSP files and served on Tomcat. I need to debug the JavaScript contained on those pages and can't figure out how to do it.

When I search for info on that, I find hints on how to:

  • Debug Java servlets running in Tomcat (I am already able to do that)
  • Debug static JavaScript files that can be loaded directly from the file system

But I don't see anything about debugging JavaScript contained in pages that are generated by the Tomcat server (in this case, from JSP pages).

Note that I am already able to debug Java servlets by creating a Tomcat server in intelliJ and running it in debug mode. When I do that, I can put breakppoints in my Java code and intelliJ will stop there when I do something in Chrome that ends up invoking that line. But if I put a breakpoint in a JavaScript file, intelliJ does not pause there.

评论操作 固定链接

Tomcat run configuration has "With JavaScript debugger option".

Once connected, you can see the scripts loaded in Chrome and place the breakpoints in these scripts:

0
评论操作 固定链接

Thx Serge, that did the trick!

0

请先登录再写评论。