문제

I'm using a Content Repository (Adobe CQ5) that has Apache Sling underneath. I'd like to render web pages using velocity templates instead of JSP. i managed to add velocity script engine to felix console and now my velocity templates run. but im struck now and dunno how to proceed further..i would like to know how to pass java objects to velocity templates,where to place those java programs and how will the script engine detect it..pls help me if anyone is familiar with this situation.

Thanks in advance

도움이 되었습니까?

해결책

The Sling Bindings mechanism allows you to make objects available to your (velocity or other) scripts.

I think https://cwiki.apache.org/SLING/adding-new-scripting-variables.html has the information that you need, in case of doubt best is to ask on the Sling users mailing list, see http://sling.apache.org/site/project-information.html

Supplying your Java logic as OSGi services is the best way to make it available to scripts, which can then grab such services with calls like sling.getService(java_class).

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top