0
votes

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

1

1 Answers

1
votes

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