Is there a way to debug Velocity templates in the traditional code debugging sense?

 ̄綄美尐妖づ 提交于 2019-12-05 01:19:14

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:

  1. create an class with logging method which return boolean value.
  2. Inject the object into velocity context
  3. From inside velocity template you can call the logging method with #if($logger.log($data)) #end

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...

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!