[redhat-ccm-list] Application-aware JSPs?

Jeff K. Hoffman jeff.hoffman at pgdc.com
Mon May 10 17:38:23 UTC 2004


Hello, list.

Over the weekend, I did some more experimentation with CCM 6.1 and JSPs. 
After following Daniel Berrange's advice, I converted my application to 
use ApplicationFileServlet, with my JSPs in web/templates/myapp.

Surprisingly, I was not able to access the current application instance 
inside a JSP. Or, if I could, I couldn't figure out how to get a 
reference to it. My test JSP was something like this:

<%@page extends="com.arsdigita.web.BaseJSP"
          import="com.arsdigita.web.Web" %>

<html>
   <body>
     <%= Web.getContext().getApplication() %>
   </body>
</html>

It displays 'null'.

After looking through the code, I noticed that the application is not 
set in the context by BaseServlet (the ancestor of BaseJSP), but by 
BaseApplicationServlet. In the absence of a BaseApplicationJSP, I 
decided to make my own, only to be shut down by the fact that the 
doService(req, resp) method of BaseApplicationServlet is declared 
'final', and cannot be overridden.

Of course, all of this is a mental excercise; I have no real-world need 
to access the Application instance in my JSP. Yet. I just assumed it 
would be a normal thing to do.

Can anyone give some context to my findings? Am I trying to do something 
that no one will ever need? Or have I found a hole in the current web 
application environment for JSPs?

--Jeff

-- 
|..  Jeff Hoffman - jeff.hoffman at pgdc.com - +1 (704) 849-0731 x108  ..|
|..     Chief Technology Officer - Planned Giving Design Center     ..|
|.. 10800 Independence Pointe Parkway, Suite D, Matthews, NC, 28105 ..|





More information about the Redhat-ccm-list mailing list