Looking for a template engine which can be used in Java and JavaScript [closed]

。_饼干妹妹 提交于 2019-12-07 06:22:45

问题


As the title says, I'm currently looking for a template engine that works with Java and Javascript. The idea is that my ajax json objects can use the same template files to render stuff client-side like Java is doing it server-side.

I know there is google-closure-template but it is working with guice 2.0 and my current project runs under guice 3.0 and both together just create wierd errors and I tried using them but failed for about 2 weeks now...

So is there anything apart from google-closure?


回答1:


You can take a look at Mustache.




回答2:


Also Histone seems to be for both

BTW: the same topic is here




回答3:


I realize this is an old question, but have you considered firing up a javax.script.ScriptEngine and running the same JS templating system in Java as well? That way you can choose the template system you actually want rather than compromising based on what languages implement it. I doubt that embedded JS in Java (Rhino/Nashorn) will perform as a well as a native Java implementation, but depending on your application that might not matter.



来源:https://stackoverflow.com/questions/7085741/looking-for-a-template-engine-which-can-be-used-in-java-and-javascript

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