The following diagram shows how a J2EE application could be implemented using Struts and adhij framework. Struts is a Application Framework developed by Apache (http://jakarta.apache.org/struts/). This framework comes in real handy for developing web components. The adhij framework is useful for building business components.

The user requests are handled by Action Servlet. Based on the struts configuration, the action servlet calls the appropriate action class with the appropriate Form class. All the request parameters are set on the Form. The action object takes the necessary parameters from the Form and calls a method on Service.

The service then calls the appropriate business object. All business logic is coded in the business object. The business object then calls the Data Access Object for any database operation and returns a value object. The Value Object contains all the attributes of a business object. The value object is used to load / update a Form. The updated form is used for showing the next page to the user by the Action servlet.

Struts, JSP and XHTML

This section describes how the JSP constructed through Struts could be made XHTML complaint.
The following are some of the steps to be followed for making the jsps XHTML complaint

1)  Use the appropriate doc type statement, for e.g., for XHTML 1.0 Transitional use the following. Struts Tag lib are

not XHTML 1.1 complaint

<!DOCTYPE html PUBLIC “-//W3C//DTD XHTML 1.0 Transitional//EN”
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html
xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" >

2) Use type = "text/JavaScript" instead of language =
"JavaScript" in script tag

<script type=”text/JavaScript” …….

3) If the javascript has && and < or > in it, move that function to a separate .js file

4) Use this tag to make the html tag generation XHTML complaint

<html:xhtml

5) Use the css for width and height for table, ts and td tags

<td style=”width: 100%; height: 528px; background: #FFFFFF;">

6) Make sure all tr s have a td inside

7) All href links should be within quotes

<a href=”Javascript:sort(1)”>

8) Enclose the input tags within the div tag

<div

<html:hidden property=”sortColumn"/>

</div>

9) Use the html encoding for characters like <, >, & etc.