Exercise 8: Creating Struts Modules
/*
First edition copyright 2004 ObjectSource LLC. All rights reserved.
This training material and the accompanying lab exercises were prepared
by Srikanth Shenoy for ObjectSource LLC.
GRANT OF LICENSE: ObjecSource LLC grants you a non-exclusive license to
use the material. No part of this publication may be reproduced, stored
in a retrieval system or transmitted in any form or by any means
electronic, mechanical, photocopying, recording or otherwise, without
the prior written permission of ObjectSource LLC. At its discretion,
ObjectSource LLC may provide limited support through email or discussion
forums at ObjectSource web site. ObjectSource incurs no obligation
to provide any support under this Agreement.
*/
/*
Technical Objectives for this exercise:
The technical objectives of this exercise is to learn ?how to?:
Create Struts application modules and break monolithic struts module into pieces
NOTE:
1. For the sake of maintaining simplicity and clarity in rest of the exercise, we will not attempt to
2. The index page belongs to the default module. From the index page, we will provide a link to go
break the existing application into modules. Rather we will add a new module.
to module2. Module 2 will consist of a two dummy pages that can call each other and also have a
link to return to default module.
a) Change the web.xml to define a new module named xyz as follows:
<init-param>
<param-name>config/xyz</param-name>
<param-value>/WEB-INF/struts-config-xyz.xml</param-value>
</init-param>
b) Copy over the struts-config.xml to create a new struts-config-xyz.xml
c) Create a empty XYZ Message Resources
d) Clean up the struts-config-xyz.xml to retain only empty blocks for form-beans, action
mappings etc. Add the message resource bundle definition to struts-config-xyz.xml.
e) Add SwitchAction to struts-config.xml & struts-config-xyz.xml as follows:
<action path="/switch" type="org.apache.struts.actions.SwitchAction"/>
f) Create a folder called xyz under the src/web directory. Create two jsps: xyz-page1.jsp & xyzpage2.
jsp (Copy over index.jsp & change contents)
.....
*/
struts-training.zip( 26,264 k)Related examples in the same category