Skip to main content
Level 3
Sep 23, 2016 5:08 PM UTC
Solved

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

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

or through the slinghttpservletrequest/slinghttpservletresponce.

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
KanikaGeraAccepted solution
Adobe Employee
Sep 23, 2016 9:15 PM UTC

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 replies

Feike_Visser1
Adobe Employee
Adobe Employee
Sep 23, 2016 8:15 PM UTC

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

Translate
smacdonald2008
Level 10
Sep 23, 2016 8:29 PM UTC

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

Translate
KanikaGeraAdobe EmployeeAccepted solution
Adobe Employee
Sep 23, 2016 9:15 PM UTC

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)
Translate
edubey
Level 10
Sep 24, 2016 8:13 AM UTC

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

Translate