Emulating requestScope Variables In Sightly For AEM

For one of our clients, that we are doing an AEM implementation for, we have certain pages that we get from a feed and stick in the jcr under each page. The pages have a bunch of components inside.

[name = Some Guy]
[name = ]

We need to prep some of the data by putting it into collections that are easy to spin through and hold them in a bean. But we have to pass that data to components on the page. We don’t want to make the bean a bunch of times.

In JSTL you can easily change the scope of variables:

which is good for passing stuff between JSPS.
Sightly does not have an easy way to do this, so I made one.

Course.java – Use API class that sets up the bean:

course-page.html – top level call to the bean Use API

author-component.html – some sub component on the page

RequestUtil.java – util to get attrbutes out of the request

Here are some additional resources from Stack Overflow if you are interested.