struts-user mailing list archives

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

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...

<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>

In the homepage.jsp

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

<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' />


Michael Mok

-----Original Message-----
From: Ned Seagoon []
Sent: Friday, 2 February 2001 19:00
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:

  // 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?

Get Your Private, Free E-mail from MSN Hotmail at

View raw message