debug JSP from eclipse

2019-01-13 17:20发布

Does anyone know of a good tool for debugging JSPs from within Eclipse? I'd like to be able to set and watch breakpoints, step through the Java code/tags, etc within Eclipse while the app is running (under JBoss in my case).

Presumably, it's reasonably straightforward to debug the servlet class that's generated from a JSP, but it's also fairly unappealing.

4条回答
Fickle 薄情
2楼-- · 2019-01-13 17:47

Apparently, Eclipse has a troubleshooting page on this, though when I tried it I did get a 404 with it. Hopefully this can at least get you started in a good direction.

查看更多
老娘就宠你
3楼-- · 2019-01-13 17:49

If you are having to use a debugger in a JSP, chances are very good that you are doing things in the JSP that you shouldn't be. I recommend that you think very hard about whether your current implementation is using good MVC design practice. JSPs really should be about presentation, which should rarely (if ever) require debugging.

If you have certain logic constructs that you are having to implement in JSP, consider implementing them using a custom tag (which is easy to debug in an IDE), or do the processing in controller servlet that presents the data in an easy to digest form for the JSP.

查看更多
萌系小妹纸
4楼-- · 2019-01-13 17:54

If you have WTP installed, you can set breakpoints within a JSP and they work fine in a regular "remote debug" session. However, once you've stopped on a breakpoint, stepping through the code is nigh on impossible and finding whatever it is that you wish to inspect takes a lot of digging around in the "Variables" view.

查看更多
我想做一个坏孩纸
5楼-- · 2019-01-13 17:58

Within Eclipse, you can put breakpoints to your jsp file, step through the Java code/tags, etc.
However the only view you can use while debugging is the Variables view to inspect the value of any variable.

And one more thing, you can not see the value for example of this expression:
<%= response.encodeURL("ProcessLogin.jsp") %>
just the value of the variable response.

查看更多
登录 后发表回答