Expand my Community achievements bar.

SOLVED

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 Accepted Solution

Avatar

Correct answer by
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)

View solution in original post

4 Replies

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

Correct answer by
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