struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Michael Mok" <micha...@consultech.net.au>
Subject RE: jsp rendering to session property for caching?
Date Fri, 02 Feb 2001 11:12:49 GMT
Ted

One way to do this is to use the template tag.

First create a template

mytemplate.jsp - a HTML page containing a table with 3 rows and 1 column
each. In each column specify...
eg

<table border="0">
   <tr><td><template:get name='header'/></td></tr>
   <tr><td><template:get name='content'/></td></tr>
   <tr><td><template:get name='footer'/></td></tr>
</table>


In the homepage.jsp

insert the template and put the required JSP pages...
eg

<template:insert template='/template/mytemplate.jsp'>
  <template:put name='header' content='/tree.jsp' />
  <template:put name='content' content='/someotherstuff.jsp' />
  <template:put name='footer' content='/layers.jsp' />
</template:insert>


Regards

Michael Mok
www.webappcabaret.com/teatimej

-----Original Message-----
From: Ned Seagoon [mailto:therealneddyseagoon@hotmail.com]
Sent: Friday, 2 February 2001 19:00
To: struts-user@jakarta.apache.org
Subject: 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.


Mime
View raw message