Hi Brian,
Check the Tiles contribution. Tiles allow to define regions/screens/templates
in a centralized file, and let an action forward to the region id.
For now, if you change the centralized file, you have to restart your webapps.
This can be solved by writing an administration page reloading explicitly the
definition file.
Tiles are integrated with Struts as a contribution (for now, only in Struts
source, soon in binary distribution). You can download Tiles binary from
original Tiles site.
Hope this help,
Cedric
Tiles sites :
http://www.lifl.fr/~dumoulin/tiles/
(mirror) : http://www.geocities.com/cedricdumoulin/tiles/
Brian K. Buckley wrote:
Hi,
I'm using struts along with the template tags from David Geary's Advanced
JavaServer Pages book.
As described in the book, I have defined all my pages in a single definition
file (for example, regionDefinitions.jsp shown below), and in order to use
the pages, I have created 2-line jsp files for each id in the definition
file, each of which calls region:render for the id (example below).
Is there a way in struts to avoid creating all these little helper jsp
files? It would be cleaner to be able to just name ids in the actions and
forwards of the struts-config.xml file rather than having to name jsp files.
Besides being bothersome, changes to the basic template file do not take
automatically - it is necessary to touch each helper jsp file before
Tomcat knows to recompile pages.
Any suggestions or comments?
- Brian
--
regionDefinitions.jsp--
region:define id='myfirstpage' scope='request' template='xxx.jsp'
region:put .../
region:put .../
/region:define
region:define id='my2ndpage' ...
...
/region:define
region:define id='my3rdpage' ...
...
/region:define
etc...
--
--
myfirstPage.jsp--
% @ include file=regionDefinitions.jsp %
% region:render region='myfirstpage'/
--
--
mysecondPage.jsp--
% @ include file=regionDefinitions.jsp %
% region:render region='my2ndpage'/
--
--
my3rdPage.jsp--
% @ include file=regionDefinitions.jsp %
% region:render region='my3rdpage'/
--
etc...