I am creating a JSP in Apache Sling, where I use a scriplet to retrieve a
list of objects, which I then want to iterate over using JSTL. However, with
the code below, I do not see any of my results within JSTL. I can use JSTL (
The important pieces:
<%
AppLinkService appLinkSvc = new AppLinkService();
String userId = "sean"; //TODO get from request
List<AppLink> links = appLinkSvc.getAppLinksFromWebService(userId);
pageContext.setAttribute("appLinkList", links);
%>
<br/>
<br/>
<c:if test="${empty appLinkList}">
You do not have any apps.
</c:if>
<c:if test="${not empty appLinkList}">
<c:forEach items="${appLinkList}" var="link">
<a href='<c:out value="${link.linkUrl}"/>'>
<c:out value="${link.appName}" />
</c:forEach>
</c:if>
I know that all of my imports are correct (I worked through all of those
errors), but now I cannot access the objects. I have this same piece of code
(with imports, etc.) working in a simple Tomcat web app, but I know things
are different in Apache Sling. It seems as though pageContext does not work
the same in the Sling world.
My goal is to use as few scriplets as possible.
What am I missing?
Thanks, Sean
--
View this message in context:
http://apache-sling.73963.n3.nabble.com/access-pageContext-variables-in-JSTL-within-Sling-tp4022591.html
Sent from the Sling - Users mailing list archive at Nabble.com.