Friday, October 13, 2006


Web Applications designed with Struts 1.2.9 in TomCat 5.5.17



Consider conversion to struts 1.2.9 architecture sample MVC
application bank-suppport (view [2],[1]).
Create directory BankActions129 under deployer folder ([1]) and copy struts-blank.war right there.

Next:-



$ cd *yer/BankActions129
$jar xvf struts-blank.war




Place apps files into subdirectories of BankActions129 as required:-




Convert HttpServlet ShowBalance:-




to Action Servlet with the same name:-




Make required changes to ./WEB-INF/struts-config.xml:-




Make sure ./WEB-INF/web.xml looks like:-




<?xml version="1.0" encoding="ISO-8859-1"?>

<!DOCTYPE web-app
PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.2//EN"
"http://java.sun.com/j2ee/dtds/web-app_2_2.dtd">

<web-app>
<display-name>Struts Bank Support Sample </display-name>

<!-- Standard Action Servlet Configuration (with debugging) -->
<servlet>
<servlet-name>action</servlet-name>
<servlet-class>org.apache.struts.action.ActionServlet</servlet-class>
<init-param>
<param-name>config</param-name>
<param-value>/WEB-INF/struts-config.xml</param-value>
</init-param>
<init-param>
<param-name>debug</param-name>
<param-value>2</param-value>
</init-param>
<init-param>
<param-name>detail</param-name>
<param-value>2</param-value>
</init-param>
<load-on-startup>2</load-on-startup>
</servlet>


<!-- Standard Action Servlet Mapping -->
<servlet-mapping>
<servlet-name>action</servlet-name>
<url-pattern>*.do</url-pattern>
</servlet-mapping>

<!-- The Usual Welcome File List -->
<welcome-file-list>
<welcome-file>index.jsp</welcome-file>
</welcome-file-list>


<!-- Struts Tag Library Descriptors -->
<taglib>
<taglib-uri>/tags/struts-bean</taglib-uri>
<taglib-location>/WEB-INF/struts-bean.tld</taglib-location>
</taglib>

<taglib>
<taglib-uri>/tags/struts-html</taglib-uri>
<taglib-location>/WEB-INF/struts-html.tld</taglib-location>
</taglib>

<taglib>
<taglib-uri>/tags/struts-logic</taglib-uri>
<taglib-location>/WEB-INF/struts-logic.tld</taglib-location>
</taglib>

<taglib>
<taglib-uri>/tags/struts-nested</taglib-uri>
<taglib-location>/WEB-INF/struts-nested.tld</taglib-location>
</taglib>

<taglib>
<taglib-uri>/tags/struts-tiles</taglib-uri>
<taglib-location>/WEB-INF/struts-tiles.tld</taglib-location>
</taglib>

</web-app>




Modify starting JSP and run:-








References.
1. http://librenix.com/?inode=9205
2. Core Servlets and JSP ,Marty Hall,Sun Press 2003
Online version:
http://volume1.coreservlets.com/archive/index.html
Chapter 15: Integrating Servlets and JSP:
The Model View Controller (MVC) Architecture