views:

231

answers:

1

I'm trying to use Groovlets in place of JSPs in an integration framework but one of the vendor's libraries relies on the javax.servlet.jsp.PageContext available in a JSP. I found the GroovyPagesPageContext class that's part of Grails for GSPs.

Anyway to use Groovy in this situation and have a handle to the jsp PageContext? I have not tried using GSPs because there's a significant amount of logic involved.

+1  A: 

Since you are replacing your JSPs with Groovlets which are Groovy Servlets, how are you using this vendor's library? If it relies on the JSP API, I'm assuming that it is normally used in a JSP, perhaps as a custom tag library? How are you using the library in a Groovlet? You would have the same problem trying to use a custom tag library inside a plain Servlet.

If you'd like a standalone class that can act as a stand-in for a JSP Page context, have a look at the JspPageContext.java class that I wrote for Rayures so that I could wrap a JSP tag library in plain Java code.

Frederic Daoud
The vendor's library doesn't use tablibs, everything is just called with Java code in scriptlets, but the API method signatures rely on the PageContext quite a bit. This will work perfectly. Thanks!
mbrevoort