You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Ned Seagoon <th...@hotmail.com> on 2001/02/02 11:59:40 UTC

jsp rendering to session property for caching?

Hi all, wonder if you can help with ideas of how I can achieve this:

I need to include two portions of html on every page - a tree structure 
which references layers that are included at another section of the page.

Both of these sections will contain a lot of iteration and bean accesses and 
this does not change too often, so I would prefer to cache this information 
on the session. (of course the best thing to do is use frames, but we cannot 
do this for various reasons)

What I would like to do is from the controller, process some view JSPs (that 
can access session beans) and store the returned html in the session object 
*before* forwarding onto pages which would write out these values onto the 
rendered page. something along these lines:

RecreateTreeAction.perform(...)
{
  // update the internal model

  request.getSession().setAttribute( "tree", RenderJsp("tree.jsp") );
  request.getSession().setAttribute( "layers", RenderJsp("layers.jsp") );

  return mapping.findForward("homepage");
}

and in say, homepage.jsp:

<bean:write name="tree">
.. whole bunch of other stuff ..
<bean:write name="layers">

Any ideas people?

Cheers
Ned
_________________________________________________________________________
Get Your Private, Free E-mail from MSN Hotmail at http://www.hotmail.com.