You aren't missing anything - pageContext works exactly the same way in Sling as it does in any Java app server.
Are you sure the problem is with your access to the variable and not with your service? Does your code work if you replace the JSTL with scriptlet? I don't see any reason why your code wouldn't work, and I use the same approach all over my code and have never had a problem with it. Paul McMahon Acquity Group ________________________________ From: seanlon11 <[email protected]> To: [email protected] Sent: Friday, March 22, 2013 12:37 PM Subject: access pageContext variables in JSTL within Sling 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.
