如何调试gsp页面? (没有grails,只是gsp) [英] how to debug a gsp page? (no grails, just gsp)

查看:278
本文介绍了如何调试gsp页面? (没有grails,只是gsp)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经尝试过netbeans和eclipse,没有运气...(不能尝试IntelliJ的想法)

I've tried with netbeans and eclipse, with no luck... (coudn't try IntelliJ idea)

我给了一个快速查看代码

I gave a quick look ant the code

http:// kickjava.com/src/groovy/servlet/TemplateServlet.java.htm

,它给我的印象是.gsp页面被翻译成.groovy servlets (groovlets)在记忆中(我可能是错的)...

and it gives me the impression that .gsp pages are translated to .groovy servlets (groovlets) in memory (I might be wrong)...

所以也许这不是很容易调试gsp,尽管...

so perhaps it's not so easy to debug gsp as I though...

所以,有人可以告诉我如何做吗?

so, can anybody tell me how to do it?

pd:通过调试我的意思是像浏览代码一步一步,显然,步骤,检查变量,添加手表和所有这些事情。不是(不是)好的旧的printf方法...

pd: By debugging I mean things like browsing the code step-by-step, inspecting variables, adding watches, and all those sort of things, obviously. Not the (not so) good old printf approach...

推荐答案

您的GSP中的大部分逻辑应该封装在TagLibs ,您可以调试它们(至少使用IntelliJ),就像其他Groovy代码一样容易。

Most of the logic in your GSPs should be encapsulated in TagLibs, and you can debug them (with IntelliJ at least), just as easily as any other Groovy code.

如果您的GSP中有很多scriptlet代码你不应该),并且你想调试它,你不能做得比 println 更多。另一种可能性是查看为您的GSP生成的Groovy代码的来源。这可以通过在URL中附加 showSource 参数来完成,如这里

If you do have a lot of scriptlet code in your GSPs (which you shouldn't), and you want to debug into it, you can't do much more than println. One other possibility is to view the source of the Groovy code generated for your GSP. This can be done by appending a showSource parameter to the URL, as described here.

这篇关于如何调试gsp页面? (没有grails,只是gsp)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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