내 커뮤니티 업적 표시줄을 확대합니다.

Submissions are now open for the 2026 Adobe Experience Maker Awards.

Mark Solution

활동이 없어 이 대화는 잠겼습니다. 새 게시물을 작성해 주세요.

해결됨

How to get instance of PageContext ( javax.servlet.jsp.PageContext ) inside Sightly class

Avatar

Level 4

We need the instance of  PageContext ( javax.servlet.jsp.PageContext )  inside a sightly class which extending WCMUsePojo class.

or through the slinghttpservletrequest/slinghttpservletresponce.

1 채택된 해결책 개

Avatar

정확한 답변 작성자:
Employee

Are you trying something like this, what is the exacyt use case? See this: http://books.gigatux.nl/mirror/javaserverpages24hours/0672325977_ch08lev1sec3.html It explains all and has good sample. 

MyGridContainerHelper gridContainer = new MyGridContainerHelper();SimpleBindings bindings = new SimpleBindings()bindings.put("resource", page.getContentResource().getChild("gridpar/my_gridwrapper"))gridContainer.init(bindings)

원본 게시물의 솔루션 보기

4 답변 개

Avatar

Employee

That is only available in the JSP-context. Why do you need it?

Avatar

Level 10

As Feike points out - you need to do this in JSP

Avatar

정확한 답변 작성자:
Employee

Are you trying something like this, what is the exacyt use case? See this: http://books.gigatux.nl/mirror/javaserverpages24hours/0672325977_ch08lev1sec3.html It explains all and has good sample. 

MyGridContainerHelper gridContainer = new MyGridContainerHelper();SimpleBindings bindings = new SimpleBindings()bindings.put("resource", page.getContentResource().getChild("gridpar/my_gridwrapper"))gridContainer.init(bindings)

Avatar

Level 10

Not sure why would you need pageContext,

but , I feel you are trying to get instance of some object. do look at https://docs.adobe.com/docs/en/htl/docs/global-objects.html which list default available global objects in sightly