有没有一种方法可以在传统的代码调试意义上调试 Velocity 模板?
我们在 Web 应用程序中大量使用 Velocity。 虽然调试 Java 方面并确保正确填充 Velocity Context 很容易,但能够在合并步骤中逐步解析 VTL、设置断点等将非常有价值。是否有任何工具或者 IDE/IDE 插件可以通过 VTL(速度模板语言)实现这种事情?
We make heavy use of Velocity in our web application. While it is easy to debug the Java side of things and ensure the Velocity Context is populated correctly, it would be extremely valuable to be able to step through the parsing of the VTL on the merge step, set breakpoints, etc. Are there any tools or IDEs/IDE plugins that would make this kind of thing possible with VTL (Velocity Template Language)?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
我还没有找到。 我能得到的最接近的是破解一个日志框架来打印出你想要的信息。
您要做的是:
#if($logger.log($data)) #end
调用日志记录方法I had not found any yet. The closest I can get is to hack a logging framework to print out information that you want.
What you do is:
#if($logger.log($data)) #end
可能有吗? 但我发现,如果所有内容都放入一张特殊的地图中,即放入上下文中,则有效。 因此,您可以在渲染时将这个特殊地图的全部内容回显到屏幕(无需知道键)...从而指示上下文中任何点的任何给定项目的确切值。 它并非万无一失,但 VTL 似乎只适用于“快速但肮脏”的东西。
There might be? but what I've found works is if everything is put into a special map, that is put into the context. Thus you can echo the entire contents of this special map to the screen while rendering (without having to know the keys)... thus indicating the exact value of any given item in the context at any point. It isn't foolproof, but VTL seems to be for "quick n dirty" stuff only.
没有逐步执行,也没有某种内置的“打印变量”。 这也让我感到困扰,但使用速度是我加入我们的项目之前做出的决定......
There is no step through, nor some kind of built in "print variables". This is something that bothers me too, but using velocity was a decision that was made before I joined our project...