How to get instance of PageContext ( javax.servlet.jsp.PageContext ) inside Sightly class | Community
Skip to main content
Level 3
September 23, 2016
Solved

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

  • September 23, 2016
  • 4 replies
  • 3721 views

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.
Best answer by KanikaGera

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
September 23, 2016

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

smacdonald2008
Level 10
September 23, 2016

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

KanikaGeraAdobe EmployeeAccepted solution
Adobe Employee
September 23, 2016

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)
edubey
Level 10
September 24, 2016

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