--- tour-1.7.htm	Wed Mar 20 10:32:49 2002
+++ tour.htm	Tue Mar 19 20:35:52 2002
@@ -1,3 +1,4 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
 <html>
 
 <head>
@@ -36,7 +37,7 @@
       <li><a href="#struts-config.xml">struts-config.xml</a></li>
       <li><a href="#struts-config.xml">LogonForm.java</a></li>
       <li><a href="#LogonAction.java">LogonAction.java</a></li>
-      <li><a href="#struts-config.xml/2">struts-config.xml 2</a></li>
+      <li><a href="#struts-config.xml_2">struts-config.xml 2</a></li>
     </ul>
   </li>
   <li><a href="#mainMenu.jsp">mainMenu.jsp</a>
@@ -183,7 +184,7 @@
     setters and getters),&nbsp;</li>
   <li>add the bean class to your application's configuration
 resource, and&nbsp;</li>
-  <li>link the bean class to your action mapping by their name properties (name="logonForm").</li>
+  <li>link the bean class to your action mapping by their name properties (name=&quot;logonForm&quot;).</li>
 </ol>
 <p>In addition to parameters representing standard HTML options, The form tag
 can also take several handy parameters to add JavaScript features to a form.
@@ -192,7 +193,7 @@
 <p>Struts has tidy mechanisms for validating forms and printing error messages. An action
 object can add as many messages as needed to a standard Struts collection. The
 JSP can then print all the messages, and clear the queue, using a single custom
-tag, &lt;html:errors/>. There can be as many messages as your validation routine cares to post.</p>
+tag, &lt;html:errors/&gt;. There can be as many messages as your validation routine cares to post.</p>
 <blockquote>
 <p><i>Struts labels this mechanism as an error message handler, though your
 application could use it for other&nbsp; messages too. For example, to post a
@@ -268,35 +269,35 @@
 </blockquote>
 <p>Go ahead and login successfully now, using the default username and password
 (user and pass).&nbsp;</p>
-<h4><font face="Arial"> <a name="struts-config.xml/2">struts-config.xml
+<h4><font face="Arial"> <a name="struts-config.xml_2">struts-config.xml
 2</a></font></h4>
 <p>As mentioned, on a successful login, LogonAction forwards control to the
 &quot;success&quot; action, and where control actually goes is determined by
 the mappings in struts-config.xml. But if you check the mappings for LogonAction,
 you'll find this block</p>
 <blockquote>
-  <p><code>    &lt;!-- Process a user logon --><br>
+  <p><code>    &lt;!-- Process a user logon --&gt;<br>
     &lt;action&nbsp;<br>
-  &nbsp;path="/logon"<br>
-  &nbsp;type="com.husted.struts.example2.LogonAction"<br>
+  &nbsp;path=&quot;/logon&quot;<br>
+  &nbsp;type=&quot;com.husted.struts.example2.LogonAction&quot;<br>
   &nbsp;name=&quot;logonForm&quot;<br>
-  &nbsp;scope="request"<br>
+  &nbsp;scope=&quot;request&quot;<br>
   &nbsp;input=&quot;/logon.jsp&quot;&gt;<br>
-    &lt;/action></code></p>
+    &lt;/action&gt;</code></p>
 </blockquote>
 <p><i>Huh!? Where's the success mapping?</i> If you dig around, you'll also find</p>
 <blockquote>
-<p><code>  &lt;!-- Global Forward Definitions --><br>
-  &lt;global-forwards><br>
+<p><code>  &lt;!-- Global Forward Definitions --&gt;<br>
+  &lt;global-forwards&gt;<br>
 &nbsp;&lt;forward&nbsp;<br>
-&nbsp;&nbsp; name="logon"&nbsp;<br>
+&nbsp;&nbsp; name=&quot;logon&quot;&nbsp;<br>
 &nbsp;&nbsp; path=&quot;/logon.jsp&quot;<br>
 &nbsp;/&gt;<br>
 &nbsp;&lt;forward&nbsp;<br>
-&nbsp;&nbsp; name="success"&nbsp;<br>
+&nbsp;&nbsp; name=&quot;success&quot;&nbsp;<br>
 &nbsp;&nbsp; path=&quot;/mainMenu.jsp&quot;<br>
 &nbsp;/&gt;<br>
-  &lt;/global-forwards></code></p>
+  &lt;/global-forwards&gt;</code></p>
 </blockquote>
 <p>Which says, if somebody says forward to &quot;success&quot;, and doesn't have
 a local forward for &quot;success&quot;, then forward using the path &quot;/mainMenu.jsp&quot;.
@@ -334,7 +335,7 @@
 logic. CheckLoginTag.java looks to see if the user is logged in by checking for
 an object named &quot;User&quot; in the session context. If not, control is
 forwarded to &quot;/login.jsp&quot;. So, whenever you want to be sure someone is
-logged in before they access a page, just put &quot;&lt;app:checkLogon/>&quot;
+logged in before they access a page, just put &quot;&lt;app:checkLogon/&gt;&quot;
 at the top of the JSP.</p>
 <blockquote>
   <p><i>If you take a good look at the CheckLoginTag source, you will probably
@@ -369,22 +370,22 @@
 <p>If you check the struts-config.xml, you'll see that the editRegistration
 action is mapped to the (surprise again!), the EditRegistrationAction; it uses a registrationForm bean, and registration.jsp for input.</p>
 <blockquote>
-  <p><code>    &lt;!-- Registration form bean --><br>
+  <p><code>    &lt;!-- Registration form bean --&gt;<br>
     &lt;form-bean name=&quot;registrationForm&quot;<br>
   type=&quot;org.apache.struts.webapp.example.RegistrationForm&quot;/&gt;</code></p>
-  <p><code>    &lt;!-- Edit user registration --><br>
+  <p><code>    &lt;!-- Edit user registration --&gt;<br>
     &lt;action path=&quot;/editRegistration&quot;<br>
   type=&quot;org.apache.struts.webapp.example.EditRegistrationAction&quot;<br>
   name=&quot;registrationForm&quot;<br>
-              scope="request"<br>
-           validate="false"<br>
-              input="/registration.jsp"><br>
-      &lt;forward name="success"              path="/registration.jsp"/><br>
-    &lt;/action></code></p>
+              scope=&quot;request&quot;<br>
+           validate=&quot;false&quot;<br>
+              input=&quot;/registration.jsp&quot;&gt;<br>
+      &lt;forward name=&quot;success&quot;              path=&quot;/registration.jsp&quot;/&gt;&gt;<br>
+    &lt;/action&gt;</code></p>
   <p><i>Hint: Consistent naming conventions, like the ones used throughout the
   Example, make applications much easier to write and understand. Save your
   creativity for the things that matter, and follow an established standard for
-  source code formatting, like the <a href="www.amazon.com/exec/obidos/ISBN=0521777682/">Elements
+  source code formatting, like the <a href="http://www.amazon.com/exec/obidos/ISBN=0521777682/">Elements
   of Java Style</a>.</i></p>
 </blockquote>
 <h4><font face="Arial"><a name="editRegistrationAction.java">EditRegistrationAction.java</a></font></h4>
@@ -414,11 +415,11 @@
 <blockquote>
   <p><code>&lt;logic:equal&nbsp;<br>
   &nbsp;name=&quot;registrationForm&quot;&nbsp;<br>
-  &nbsp;property="action"<br>
-  &nbsp;scope="request"&nbsp;<br>
+  &nbsp;property=&quot;action&quot;<br>
+  &nbsp;scope=&quot;request&quot;&nbsp;<br>
   &nbsp;value=&quot;Edit&quot;<br>
   &gt;<br>
-  &nbsp; &lt;app:checkLogon/><br>
+  &nbsp; &lt;app:checkLogon/&gt;<br>
   &lt;/logic:equal&gt;</code></p>
 <p><i>Note that the Struts html:form tag will refer to properties set by struts-config.xml and automatically create a registrationForm bean if one is not present. However, that does not happen until the form tag is processed within the page. Since this
 block appears before the html:form tag, a runtime error is exposed if you try to access registration.jsp directly (rather then going through the editRegistration.do action).</i></p>
@@ -437,8 +438,8 @@
 <blockquote>
 <p><code>&lt;logic:equal&nbsp;<br>
 &nbsp;name=&quot;registrationForm&quot;&nbsp;<br>
-&nbsp;property="action"<br>
-&nbsp;scope="request"&nbsp;<br>
+&nbsp;property=&quot;action&quot;<br>
+&nbsp;scope=&quot;request&quot;&nbsp;<br>
 &nbsp;value=&quot;Edit&quot;<br>
 &gt;</code></p>
 </blockquote>
@@ -453,9 +454,9 @@
 the user object, and loop through the members of the subscription collection.
 Using the iterate tag, this couldn't be easier.&nbsp;</p>
 <blockquote>
-  <p>&lt;logic:iterate name="user" property=&quot;subscriptions&quot; id="subscription"&gt;<br>
+  <p>&lt;logic:iterate name=&quot;user&quot; property=&quot;subscriptions&quot; id=&quot;subscription&quot;&gt;<br>
   &lt;!-- block to repeat --&gt;<br>
-  &lt;/logic:iterate></p>
+  &lt;/logic:iterate&gt;</p>
 </blockquote>
 <p>The three parameters to the iterate tag ( name, property, and id) tell it to</p>
 <ol>
@@ -468,9 +469,9 @@
 could write:</p>
 <blockquote>
 <p><code>&lt;ul&gt;<br>
-&nbsp; &lt;logic:iterate name="user" property=&quot;subscriptions&quot; id="subscription"&gt;<br>
+&nbsp; &lt;logic:iterate name=&quot;user&quot; property=&quot;subscriptions&quot; id=&quot;subscription&quot;&gt;<br>
 &nbsp;&nbsp;&nbsp; &lt;li&gt;<br>
-&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;bean:write name="subscription" property="host" filter=&quot;true&quot; /&gt;<br>
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;bean:write name=&quot;subscription&quot; property=&quot;host&quot; filter=&quot;true&quot; /&gt;<br>
 &nbsp;&nbsp;&nbsp; &lt;/li&gt;<br>
 &nbsp; &lt;/logic:iterate&gt;<br>
 &lt;/ul&gt;</code></p>
@@ -479,29 +480,29 @@
 <p>In registration.jsp, iterate is used to create a menu of subscriptions, each
 linked with an edit and delete action.</p>
 <blockquote>
-  <p><code>&lt;logic:iterate id="subscription" name="user" property="subscriptions"><br>
-  &lt;tr><br>
-    &lt;td align="left"><br>
-      &lt;bean:write name="subscription" property="host" filter="true"/><br>
-    &lt;/td><br>
-    &lt;td align="left"><br>
-      &lt;bean:write name="subscription" property="username" filter="true"/><br>
-    &lt;/td><br>
-    &lt;td align="center"><br>
-      &lt;bean:write name="subscription" property="type" filter="true"/><br>
-    &lt;/td><br>
-    &lt;td align="center"><br>
-      &lt;bean:write name="subscription" property="autoConnect"/><br>
-    &lt;/td><br>
-    &lt;td align="center"><br>
-      &lt;app:linkSubscription page="/editSubscription.do?action=Delete"><br>
-        &lt;bean:message key="registration.deleteSubscription"/><br>
-      &lt;/app:linkSubscription><br>
-      &lt;app:linkSubscription page="/editSubscription.do?action=Edit"><br>
-        &lt;bean:message key="registration.editSubscription"/><br>
-      &lt;/app:linkSubscription><br>
-    &lt;/td><br>
-  &lt;/tr><br>
+  <p><code>&lt;logic:iterate id=&quot;subscription&quot; name=&quot;user&quot; property=&quot;subscriptions&quot;&gt;<br>
+  &lt;tr&gt;<br>
+    &lt;td align=&quot;left&quot;&gt;<br>
+      &lt;bean:write name=&quot;subscription&quot; property=&quot;host&quot; filter=&quot;true&quot;/&gt;<br>
+    &lt;/td&gt;<br>
+    &lt;td align=&quot;left&quot;&gt;<br>
+      &lt;bean:write name=&quot;subscription&quot; property=&quot;username&quot; filter=&quot;true&quot;/&gt;<br>
+    &lt;/td&gt;<br>
+    &lt;td align=&quot;center&quot;&gt;<br>
+      &lt;bean:write name=&quot;subscription&quot; property=&quot;type&quot; filter=&quot;true&quot;/&gt;<br>
+    &lt;/td&gt;<br>
+    &lt;td align=&quot;center&quot;&gt;<br>
+      &lt;bean:write name=&quot;subscription&quot; property=&quot;autoConnect&quot;/&gt;<br>
+    &lt;/td&gt;<br>
+    &lt;td align=&quot;center&quot;&gt;<br>
+      &lt;app:linkSubscription page=&quot;/editSubscription.do?action=Delete&quot;&gt;<br>
+        &lt;bean:message key=&quot;registration.deleteSubscription&quot;/&gt;<br>
+      &lt;/app:linkSubscription&gt;<br>
+      &lt;app:linkSubscription page=&quot;/editSubscription.do?action=Edit&quot;&gt;<br>
+        &lt;bean:message key=&quot;registration.editSubscription&quot;/&gt;<br>
+      &lt;/app:linkSubscription&gt;<br>
+    &lt;/td&gt;<br>
+  &lt;/tr&gt;<br>
   &lt;/logic:iterate&gt;</code></p>
 <p><i>The collection in an iterate tag can be any of the following: an array of objects, an Iterator, a Collection (which includes Lists, Sets and Vectors), or a Map (which includes Hashtables) whose elements will be iterated over.&nbsp;</i></p>
 </blockquote>
@@ -533,15 +534,15 @@
     </i><code>subscription = (Subscription) pageContext.findAttribute(name);</code></li>
   <li><i>Append the username and host from the bean to the path request.<br>
     </i><code>url.append(&quot;&amp;username=&quot;); url.append(BeanUtils.filter(subscription.getUser().getUsername()));<br>
-    url.append(&quot;&amp;host=");&nbsp;<br>
+    url.append(&quot;&amp;host=&quot;);&nbsp;<br>
     url.append(BeanUtils.filter(subscription.getHost()));</code></li>
 </ol>
 <p>These are the essentials, but be sure to see the full source in LinkSubscriptionTag.java for the rest of the error and logic checking that a working application needs to succeed.&nbsp;</p>
 <p>Meanwhile, back on registration.jsp, there is one more link on the page. This uses yet another custom tag, the app:linkUser tag.</p>
 <blockquote>
-  <p><code>&lt;app:linkUser page="/editSubscription.do?action=Create"><br>
-  &nbsp; &lt;bean:message key="registration.addSubscription"/><br>
-  &lt;/app:linkUser></code></p>
+  <p><code>&lt;app:linkUser page=&quot;/editSubscription.do?action=Create&quot;&gt;<br>
+  &nbsp; &lt;bean:message key=&quot;registration.addSubscription&quot;/&gt;<br>
+  &lt;/app:linkUser&gt;</code></p>
 </blockquote>
 <p>By this time, you must be ready to flip directly to LinkUserTag.java with nary a glance at the configuration file ...</p>
 <h4><font face="Arial"><a name="LinkUserTag.java">LinkUserTag.java</a></font></h4>
@@ -549,36 +550,36 @@
 &quot;user&quot;) is defaulted,
 and can be omitted from the tag; all that's needed is the page property -- the rest is automatic!</p>
 <blockquote>
-  <p><font size="2">&lt;app:linkUser page="/editSubscription.do?action=Create"><br>
-  &nbsp; &lt;bean:message key="registration.addSubscription"/><br>
-  &lt;/app:linkUser></font></p>
+  <p><font size="2">&lt;app:linkUser page=&quot;/editSubscription.do?action=Create&quot;&gt;<br>
+  &nbsp; &lt;bean:message key=&quot;registration.addSubscription&quot;/&gt;<br>
+  &lt;/app:linkUser&gt;</font></p>
 </blockquote>
 <p>When rendered, this displays a HTML hypertext link like:</p>
 <blockquote>
-  <p><font size="2"><code>&lt;a href=&quot;/struts-example/editSubscription.do?action=Create&amp;amp;username=user"><br>
+  <p><font size="2"><code>&lt;a href=&quot;/struts-example/editSubscription.do?action=Create&amp;amp;username=user&quot;&gt;<br>
   &nbsp; Add<br>
-  &lt;/a></code></font></p>
+  &lt;/a&gt;</code></font></p>
 <p><i>Note that anchor links with ampersands should use the character entity &amp;amp; as the LinkUserTag has done here (<a href="http://www.w3.org/TR/html401/appendix/notes.html#h-B.2.2">http://www.w3.org/TR/html401/appendix/notes.html#h-B.2.2</a>).&nbsp;</i></p>
 </blockquote>
 <p>Let's follow that &quot;Add&quot;&nbsp; link now and see what's up with the editSubcription action anyway.&nbsp;</p>
 <h4><a name="EditSubscriptionAction.java"><font face="Arial">EditSubscriptionAction.java</font></a></h4>
 <p>Predictably, we find a some now-familiar mappings in struts-config.xml&nbsp;</p>
 <blockquote>
-  <p>    <code>    &lt;!-- Subscription form bean --><br>
+  <p>    <code>    &lt;!-- Subscription form bean --&gt;<br>
     &lt;form-bean&nbsp;<br>
   &nbsp; name=&quot;subscriptionForm&quot;<br>
   &nbsp; type=&quot;org.apache.struts.webapp.example.SubscriptionForm&quot;<br>
   /&gt;</code></p>
-  <p>   <code>   &lt;!-- Edit mail subscription --><br>
-    &lt;action    path="/editSubscription"<br>
+  <p>   <code>   &lt;!-- Edit mail subscription --&gt;<br>
+    &lt;action    path=&quot;/editSubscription&quot;<br>
   &nbsp; type=&quot;org.apache.struts.webapp.example.EditSubscriptionAction&quot;<br>
   &nbsp; name=&quot;subscriptionForm&quot;<br>
-  &nbsp; scope="request"<br>
+  &nbsp; scope=&quot;request&quot;<br>
   &nbsp; validate=&quot;false&quot;<br>
   &nbsp;&gt;<br>
-  &nbsp; &lt;forward name="failure"              path="/mainMenu.jsp"/><br>
-  &nbsp; &lt;forward name="success"              path="/subscription.jsp"/><br>
-    &lt;/action></code></p>
+  &nbsp; &lt;forward name=&quot;failure&quot;              path=&quot;/mainMenu.jsp&quot;/&gt;<br>
+  &nbsp; &lt;forward name=&quot;success&quot;              path=&quot;/subscription.jsp&quot;/&gt;<br>
+    &lt;/action&gt;</code></p>
   <p><i>When we've introduced these type of mappings before, and mentioned that the struts-config.xml was parsed when the ActionServlet was initialized. But we should&nbsp; make it clear that when the Struts digester parsed this file, it actually created
   standard Java objects, linked as properties to the controller. This means you don't have to edit Java source files just to add a bunch of &quot;new&quot; statements. (How cool is that?)</i></p>
 </blockquote>
@@ -602,20 +603,20 @@
 <p>In registration.jsp, the Struts iteration tag was used to write a list of subscriptions. Another place where iterations and collections are handy is the option list for a HTML select tag. Since this is such a common situation, Struts offers a
 html:options (plural) tag can take an array of objects as a parameter. The tag then iterates over the members of the array (beans) to place each one inside an standard option tag. So given a block like</p>
 <blockquote>
-  <p><code>      &lt;html:select property="type"><br>
+  <p><code>      &lt;html:select property=&quot;type&quot;&gt;<br>
         &lt;html:options<br>
   &nbsp;collection=&quot;serverTypes&quot;<br>
-  &nbsp;property="value"<br>
+  &nbsp;property=&quot;value&quot;<br>
   &nbsp;labelProperty=&quot;label&quot;<br>
   /&gt;<br>
       &lt;/html:select&gt;</code></p>
 </blockquote>
 <p>Struts outputs a block like</p>
 <blockquote>
-  <p><code>      &lt;select name="type"><br>
-        &lt;option value="imap" selected>IMAP Protocol&lt;/option><br>
-  &lt;option value="pop3">POP3 Protocol&lt;/option><br>
-      &lt;/select></code></p>
+  <p><code>      &lt;select name=&quot;type&quot;&gt;<br>
+        &lt;option value=&quot;imap&quot; selected&gt;IMAP Protocol&lt;/option&gt;<br>
+  &lt;option value=&quot;pop3&quot;&gt;POP3 Protocol&lt;/option&gt;<br>
+      &lt;/select&gt;</code></p>
 </blockquote>
 <p> Here, one collection contained both the labels and the values, from properties of the same name. Options can also use a second array&nbsp; for the labels, if they do not match the values. Options can use a Collection, Iterator, or Map for the source of
 the list.<p>For demonstrations purposes, the serverTypes array is created at the top of this page. Usually, the html:options tag would be used to list valid items from a database maintained elsewhere. For example, if the application needed you to select a
@@ -638,13 +639,13 @@
 <blockquote>
   <p><code>      &lt;logic:equal&nbsp;<br>
   &nbsp;name=&quot;subscriptionForm&quot;<br>
-  &nbsp;property="action"<br>
-  &nbsp;scope="request"<br>
-  &nbsp;value="Create"><br>
+  &nbsp;property=&quot;action&quot;<br>
+  &nbsp;scope=&quot;request&quot;<br>
+  &nbsp;value=&quot;Create&quot;&gt;<br>
   &nbsp;&lt;html:submit&gt;<br>
-  &nbsp;&nbsp; <b>&lt;bean:message key="button.save"/><br>
-  </b>&nbsp;&lt;/html:submit><br>
-      &lt;/logic:equal></code></p>
+  &nbsp;&nbsp; <b>&lt;bean:message key=&quot;button.save&quot;/&gt;<br>
+  </b>&nbsp;&lt;/html:submit&gt;<br>
+      &lt;/logic:equal&gt;</code></p>
 </blockquote>
 <p>In the case of a request to delete a subscription, the submit button is labeled &quot;Confirm&quot;, since this view is meant to give the user a last chance to cancel, before sending that task along to SaveSubscriptionAction.java.</p>
 <p>The actual action property is placed into the form as a hidden field, and SaveSubscriptionAction checks that property to execute the appropriate task.</p>
