[opencms-dev] Sharing state across included JSPs
Jonathan Woods
jonathan.woods at scintillance.com
Tue Feb 28 21:08:42 CET 2006
I have a JSP template which uses <cms:include> to include a couple of other
JSP page elements (header and footer, predictably enough). I create an
object or two in the header which I need to use in the page body and in the
footer, but at the moment I'm struggling to see how I can share the object
reference:
1. Putting it into the page context, either via Java
(pageContext.setAttribute()) or via <jsp:useBean>, doesn't seem to work - I
guess this is because the 'include' is dynamic and we're dealing with
different Java scopes.
2. Same with the request context, again because the include is dynamic.
OpenCms documentation suggests that you can set request parameters before
executing the include, but from the taglib only String setting is possible -
and I want to share a reference to something other than a String.
3. Putting it into session context is (i) a pity, because otherwise I don't
need to set up sessions and maintain session state, and (ii) not really
appropriate, because in theory the same client could make two requests so
quickly that two JSP-serving threads would hit the same session state. I
realise there are ways round (ii), but I'd rather not go there if there's an
easier solution.
Any ideas welcomed. I would really love to get on with some coding and stop
having to wrestle with the execution environment like this!
Jon
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://webmail.opencms.org/pipermail/opencms-dev/attachments/20060228/fafabac9/attachment.htm>
More information about the opencms-dev
mailing list