~ubuntu-branches/ubuntu/trusty/libstruts1.2-java/trusty-proposed

« back to all changes in this revision

Viewing changes to xdocs/faqs/apps.xml

  • Committer: Bazaar Package Importer
  • Author(s): Arnaud Vandyck
  • Date: 2004-11-19 15:35:25 UTC
  • Revision ID: james.westby@ubuntu.com-20041119153525-mdu08a76z4zo67xt
Tags: upstream-1.2.4
ImportĀ upstreamĀ versionĀ 1.2.4

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
<?xml version="1.0"?>
 
2
<document url="./apps.xml">
 
3
<properties>
 
4
<author>Dan Walker</author>
 
5
<author>Ted Husted</author>
 
6
<title>Building Applications</title>
 
7
</properties>
 
8
<body>
 
9
<section name="How to Build Applications" href="building_apps"/>
 
10
<section href="intro" name="About This Document">
 
11
<p>
 
12
This document outlines one possible sequence of development steps that can be followed to create a
 
13
Struts application.  It is not intended as a complete description of each
 
14
referenced development activity.  More detailed documentation is available
 
15
elsewhere and is referenced by "(more...)" links where possible.
 
16
</p>
 
17
</section>
 
18
 
 
19
<section href="caveats" name="Caveats">
 
20
<ol>
 
21
<li>Requirements development and design are outside of the scope of this  document.</li>
 
22
<li>For help installing Struts, see the <a href="../userGuide/installation.html">Getting Started</a> chapter.</li>
 
23
<li>There are many other ways to approach Struts development and there are many
 
24
    other features available besides the ones discussed below. This document
 
25
    outlines only one way to get started.</li>
 
26
<li>This document focuses on form/data centric applications, but may also work with
 
27
    other types of applications.</li>
 
28
<li>This material was written for Struts 1.1 (beta 2).</li>
 
29
</ol>
 
30
</section>
 
31
 
 
32
<section href="overview" name="Overview">
 
33
<ol>
 
34
<li>Implement data entry forms as JSP files.</li>
 
35
<li>Implement one or more <code>ActionForm</code> descendents to buffer data
 
36
    between JSPs and Actions.</li>
 
37
<li>Create an XML document that defines the validation rules for your
 
38
    application.</li>
 
39
<li>Implement one or more <code>Action</code> descendents to respond form
 
40
    submissions.</li>
 
41
<li>Create <code>struts-config.xml</code> to associate forms with
 
42
    actions.</li>
 
43
<li>Create or update <code>web.xml</code> to reference
 
44
    <code>ActionServlet</code>, taglibs used by Struts.</li>
 
45
<li>Parallel Tasks
 
46
<ol>
 
47
<li>Building</li>
 
48
<li>Unit Testing</li>
 
49
<li>Deployment</li>
 
50
</ol>
 
51
</li>
 
52
</ol>
 
53
</section>
 
54
 
 
55
<section href="details" name="Details">
 
56
<ol>
 
57
<li>Implement data entry forms as JSP files.
 
58
<ol>
 
59
<li>Use elements from the <code>html</code> taglib
 
60
    to define the form elements. <a href="../userGuide/struts-html.html">
 
61
    (more...)</a></li>
 
62
<li>Use <code>message</code> and other elements from the <code>bean</code>
 
63
    taglib to define the labels and other static text of the form. 
 
64
    <a href="../userGuide/struts-bean.html">(more...)</a>
 
65
<ol>
 
66
<li>Create and maintain a properties file of the text elements
 
67
    to be displayed. <a href="../userGuide/preface.html#resources">(more...) 
 
68
    </a></li>
 
69
</ol>
 
70
</li>
 
71
<li>Use <code>property</code> attributes to link form fields to 
 
72
    <code>ActionForm</code> instance variables.</li>
 
73
</ol>
 
74
</li>
 
75
<li>Implement one or more <code>ActionForm</code> descendents
 
76
    to buffer data between JSPs and Actions.
 
77
<ol>
 
78
<li>Create get/set pairs that correspond to the property names
 
79
    in your related JSP form. Example:
 
80
<pre>&lt;html:text property="city" /&gt;</pre>
 
81
    needs:
 
82
<pre>getCity() and setCity(String c)</pre>
 
83
</li>
 
84
<li>When needed, create a <code>reset</code> method
 
85
    that sets the fields of the <code>ActionForm</code> to their default values. Most ActionForms do not need to do this.</li>
 
86
</ol>
 
87
</li>
 
88
<li>Create an XML document that defines the validation rules for your
 
89
    application.</li>
 
90
<li>Implement one or more <code>Action</code> descendents
 
91
    to respond to form submissions.
 
92
<ol>
 
93
<li>Descend from DispatchAction or LookupDispatchAction if you
 
94
    want one class to handle more than one kind of event (example: one Action
 
95
    to handle 'insert', 'update' and 'delete' events, using a different "surrogate" execute method for each). <a href="http://husted.com/struts/tips/002.html">(more...)</a></li>
 
96
<li>Use the <code>execute</code> method
 
97
    (or its surrogates) of your Action class to interface with objects in your
 
98
    application responsible for database interaction, such as EJBs, etc.
 
99
    <!-- [:TODO: find good doc to link to] -->
 
100
</li>
 
101
<li>Use the return value of the <code>execute</code> method
 
102
    (or its surrogates) direct the user interface to the appropriate next page.
 
103
<!-- [:TODO: find good doc to link to] -->
 
104
</li>
 
105
</ol>
 
106
</li>
 
107
<li>Create <code>struts-config.xml</code> to
 
108
    associate forms with actions. The file minimally needs:</li>
 
109
<li>Create or update <code>web.xml</code> to
 
110
    reference <code>ActionServlet</code>, taglibs used by Struts. <a href="../userGuide/configuration.html#dd_config"> (more...)</a></li>
 
111
<li>Parallel Tasks
 
112
<ol>
 
113
<li>Building
 
114
<ol>
 
115
<li>Use Ant. It can compile, create WAR file, perform XSLT
 
116
   transformations, run unit tests, interact with version control systems,
 
117
   clean up, etc. <a href="http://jakarta.apache.org/ant"> (more...)</a></li>
 
118
<li>Create and use build script incrementally, as you create
 
119
    files that need to be copied, compiled, etc. </li>
 
120
</ol>
 
121
</li>
 
122
<li>Unit Testing
 
123
<ol>
 
124
<li>Unit test normal java beans with JUnit. <a href="http://www.junit.org"> (more...)</a></li>
 
125
<li>Unit test JSP, taglibs and conventional servlet components
 
126
    with Cactus. <a href="http://jakarta.apache.org/cactus"> (more...)</a></li>
 
127
<li>Unit test Action servlets with StrutsTestCase. <a href="http://strutstestcase.sourceforge.net"> (more...)</a></li>
 
128
<li>Add all unit tests to the build script as a separate
 
129
    target. This target should use the <code>junit</code> tag to launch each TestCase descendent. <a href="http://jakarta.apache.org/ant/manual/OptionalTasks/junit.html"> (more...)</a></li>
 
130
</ol>
 
131
</li>
 
132
<li>Deployment
 
133
<ol>
 
134
<li>Build script should create a war file containing the
 
135
    files developed above, along with files that make up the Struts framework.
 
136
    <!-- [:TODO: describe this further, look for doc to link to] -->
 
137
</li>
 
138
</ol>
 
139
</li>
 
140
</ol>
 
141
</li>
 
142
</ol></section>
 
143
 
 
144
</body>
 
145
</document>