craigmcc    01/01/22 21:06:49

  Modified:    src/doc/userGuide building_controller.xml building_model.xml
                        building_view.xml
  Log:
  More tweaks to improve the printability of the User's Guide, without
  having to resort wholesale to smaller font sizes for the examples.  The
  entire guide will now print for me in portrait mode.
  
  Revision  Changes    Path
  1.9       +146 -101  jakarta-struts/src/doc/userGuide/building_controller.xml
  
  Index: building_controller.xml
  ===================================================================
  RCS file: /home/cvs/jakarta-struts/src/doc/userGuide/building_controller.xml,v
  retrieving revision 1.8
  retrieving revision 1.9
  diff -u -r1.8 -r1.9
  --- building_controller.xml   2001/01/22 04:44:07     1.8
  +++ building_controller.xml   2001/01/23 05:06:49     1.9
  @@ -8,7 +8,7 @@
     </properties>
     
     <body>  
  -  <chapter name="Building Controller Components" href="building_controller">
  +  <chapter name="4. Building Controller Components" href="building_controller">
     
         <section name="4.1 Overview" href="overview">
           
  @@ -39,19 +39,21 @@
         
         <p>The <code>Action</code> class defines two methods that could be
           executed depending on your servlet environment:
  -<pre><font size="-1">public ActionForward perform(ActionMapping mapping,
  -                      ActionForm form,
  -                      ServletRequest request,
  -                    ServletResponse response)
  -  throws IOException, ServletException
  -
  -   public ActionForward perform(ActionMapping mapping,
  -                      ActionForm form,
  -                      HttpServletRequest request,
  -                    HttpServletResponse response)
  -  throws IOException, ServletException   
  -</font></pre>
         </p>
  +
  +<pre>
  +public ActionForward perform(ActionMapping mapping,
  +                             ActionForm form,
  +                             ServletRequest request,
  +                             ServletResponse response)
  +  throws IOException, ServletException;
  +
  +public ActionForward perform(ActionMapping mapping,
  +                             ActionForm form,
  +                             HttpServletRequest request,
  +                             HttpServletResponse response)
  +  throws IOException, ServletException;
  +</pre>
         
         <p>
           Most people would only use the "HttpServletRequest" version. 
  @@ -265,25 +267,32 @@
           to illustrate the requirements.  Note that the entries for all the other 
actions
           are left out:
         </p>
  -<pre><font size="-1">&lt;struts-config>
  -      &lt;form-beans>
  -        &lt;form-bean name="logonForm"
  -                type="org.apache.struts.example.LogonForm">
  -      &lt;/form-beans>      
  -      &lt;global-forwards type="org.apache.struts.action.ActionForward">
  -      &lt;forward name="logon" path="/logon.jsp" redirect="false" /> 
  -    &lt;/global-forwards>      
  -    &lt;action-mappings&gt;     
  -      &lt;action path="/logon" 
  -              type="org.apache.struts.example.LogonAction"
  -              name="logonForm"
  -              scope="request"
  -              input="/logon.jsp"
  -              unknown="false"
  -              validate="true" />          
  -    &lt;/action-mappings&gt;
  - &lt;/struts-config>
  -</font></pre>      
  +
  +<pre>
  +&lt;struts-config>
  +  &lt;form-beans>
  +    &lt;form-bean
  +      name="logonForm"
  +      type="org.apache.struts.example.LogonForm" />
  +  &lt;/form-beans>      
  +  &lt;global-forwards
  +      type="org.apache.struts.action.ActionForward" />
  +    &lt;forward name="logon" path="/logon.jsp"
  +         redirect="false" /> 
  +  &lt;/global-forwards>      
  +  &lt;action-mappings&gt;     
  +    &lt;action
  +        path="/logon" 
  +        type="org.apache.struts.example.LogonAction"
  +        name="logonForm"
  +       scope="request"
  +       input="/logon.jsp"
  +     unknown="false"
  +    validate="true" />          
  +  &lt;/action-mappings&gt;
  +&lt;/struts-config>
  +</pre>      
  +
         <p>
           First the form bean is defined.  A basic bean of class 
"org.apache.struts.example.LogonForm"
           is mapped to the logical name "logonForm".  This name is used as a session 
or request attribute
  @@ -309,21 +318,23 @@
           specifies data sources that your application can use.This is how you would 
specify a basic data source for your application inside
           of struts-config.xml:
         </p>
  -      <p>
  -<pre><font size="-1">&lt;struts-config>
  -    &lt;data-sources>
  -      &lt;data-source autoCommit="false"
  -                 description="Example Data Source Description"
  -                 driverClass="org.postgresql.Driver"
  -                   maxCount="4"
  -                   minCount="2"
  -                   password="mypassword"
  -                   url="jdbc:postgresql://localhost/mydatabase"
  -                   user="myusername"/>
  -    &lt;/data-sources>
  -  &lt;/struts-config>
  -</font></pre>
  -      </p>  
  +
  +<pre>
  +&lt;struts-config>
  +  &lt;data-sources>
  +    &lt;data-source
  +      autoCommit="false"
  +     description="Example Data Source Description"
  +     driverClass="org.postgresql.Driver"
  +        maxCount="4"
  +        minCount="2"
  +        password="mypassword"
  +             url="jdbc:postgresql://localhost/mydatabase"
  +            user="myusername"/>
  +  &lt;/data-sources>
  +&lt;/struts-config>
  +</pre>
  +
         <p>
           For information on how to retrieve the data source, see the 
           <a href="building_model.html#databases">Accessing Relational Databases</a> 
section.  
  @@ -345,29 +356,39 @@
           <p>
             Add an entry defining the action servlet itself, along with the 
appropriate
             initialization parameters.  Such an entry might look like this:
  -<pre><font size="-1">&lt;servlet&gt;
  -     &lt;servlet-name&gt;action&lt;/servlet-name&gt;
  -     
&lt;servlet-class&gt;org.apache.struts.action.ActionServlet&lt;/servlet-class&gt;
  -     &lt;init-param&gt;
  -       &lt;param-name&gt;application&lt;/param-name&gt;
  -       
&lt;param-value&gt;org.apache.struts.example.ApplicationResources&lt;/param-value&gt;
  -     &lt;/init-param&gt;
  -     &lt;init-param&gt;
  -       &lt;param-name&gt;config&lt;/param-name&gt;
  -       &lt;param-value&gt;/WEB-INF/struts-config.xml&lt;/param-value&gt;
  -     &lt;/init-param&gt;
  -     &lt;init-param&gt;
  -       &lt;param-name&gt;debug&lt;/param-name&gt;
  -       &lt;param-value&gt;2&lt;/param-value&gt;
  -     &lt;/init-param&gt;
  -     &lt;init-param&gt;
  -       &lt;param-name&gt;mapping&lt;/param-name&gt;
  -       
&lt;param-value&gt;org.apache.struts.example.ApplicationMapping&lt;/param-value&gt;
  -     &lt;/init-param&gt;
  -     &lt;load-on-startup&gt;2&lt;/load-on-startup&gt;
  -   &lt;/servlet&gt;
  -</font></pre>
           </p>
  +
  +<pre>
  +&lt;servlet&gt;
  +  &lt;servlet-name&gt;action&lt;/servlet-name&gt;
  +  &lt;servlet-class&gt;
  +    org.apache.struts.action.ActionServlet
  +  &lt;/servlet-class&gt;
  +  &lt;init-param&gt;
  +    &lt;param-name&gt;application&lt;/param-name&gt;
  +    &lt;param-value&gt;
  +      org.apache.struts.example.ApplicationResources
  +    &lt;/param-value&gt;
  +  &lt;/init-param&gt;
  +  &lt;init-param&gt;
  +    &lt;param-name&gt;config&lt;/param-name&gt;
  +    &lt;param-value&gt;
  +      /WEB-INF/struts-config.xml
  +    &lt;/param-value&gt;
  +  &lt;/init-param&gt;
  +  &lt;init-param&gt;
  +    &lt;param-name&gt;debug&lt;/param-name&gt;
  +    &lt;param-value&gt;2&lt;/param-value&gt;
  +  &lt;/init-param&gt;
  +  &lt;init-param&gt;
  +    &lt;param-name&gt;mapping&lt;/param-name&gt;
  +    &lt;param-value&gt;
  +      org.apache.struts.example.ApplicationMapping
  +    &lt;/param-value&gt;
  +  &lt;/init-param&gt;
  +  &lt;load-on-startup&gt;2&lt;/load-on-startup&gt;
  +&lt;/servlet&gt;
  +</pre>
           
           <p>
             The initialization parameters supported by the controller servlet are
  @@ -465,19 +486,22 @@
             path part) with a particular value to be passed to this servlet.  Such an
             entry might look like this:
           </p>
  -<pre><font size="-1">&lt;servlet-mapping&gt;
  +
  +<pre>
  +  &lt;servlet-mapping&gt;
        &lt;servlet-name&gt;action&lt;/servlet-name&gt;
        &lt;url-pattern&gt;/execute/*&lt;/url-pattern&gt;
      &lt;/servlet-mapping&gt;
  -</font></pre>
  +</pre>
           
           <p>
             which means that a request URI to match the <code>/logon</code> path
             described earlier might look like this:</p>
  -        <p>
  -          <code> http://www.mycompany.com/myapplication/execute/logon</code>
  -        </p>
  -        
  +
  +<pre><font size="-1">
  +http://www.mycompany.com/myapplication/execute/logon
  +</font></pre>
  +
           <p>
             where <code>/myapplication</code> is the context path under which your
             application is deployed.
  @@ -490,18 +514,23 @@
             to the <code>*.jsp</code> pattern so that it is called to process every
             JSP page that is requested.  To use the <code>*.do</code> extension (which
             implies "do something"), the mapping entry would look like this:
  -<pre><font size="-1">&lt;servlet-mapping&gt;
  +        </p>
  +
  +<pre>
  +  &lt;servlet-mapping&gt;
        &lt;servlet-name&gt;action&lt;/servlet-name&gt;
        &lt;url-pattern&gt;*.do&lt;/url-pattern&gt;
      &lt;/servlet-mapping&gt;
  -</font></pre>
  -        </p>
  +</pre>
           
           <p>
             and a request URI to match the <code>/logon</code> path described
  -          earlier might look like this:<br />
  -          <code> http://www.mycompany.com/myapplication/logon.do</code>
  +          earlier might look like this:
           </p>
  +
  +<pre><font size="-1">
  +http://www.mycompany.com/myapplication/logon.do
  +</font></pre>
         </section>
         
         <section name="4.5.3 Configure the Struts Tag Library" 
href="dd_config_taglib">
  @@ -532,26 +561,44 @@
           
           <p>
             Below is how you would define all taglibs for use within your application,
  -          in reality you would only specify the taglib's that your application will 
use:          
  -<pre><font size="-1">&lt;taglib&gt;
  -   &lt;taglib-uri&gt;/WEB-INF/struts-bean.tld&lt;/taglib-uri&gt;
  -   &lt;taglib-location&gt;/WEB-INF/struts-bean.tld&lt;/taglib-location&gt;
  - &lt;/taglib&gt;
  - &lt;taglib&gt;
  -   &lt;taglib-uri&gt;/WEB-INF/struts-html.tld&lt;/taglib-uri&gt;
  -   &lt;taglib-location&gt;/WEB-INF/struts-html.tld&lt;/taglib-location&gt;
  - &lt;/taglib&gt;
  - &lt;taglib&gt;
  -   &lt;taglib-uri&gt;/WEB-INF/struts-logic.tld&lt;/taglib-uri&gt;
  -   &lt;taglib-location&gt;/WEB-INF/struts-logic.tld&lt;/taglib-location&gt;
  - &lt;/taglib&gt;
  - &lt;taglib&gt;
  -   &lt;taglib-uri&gt;/WEB-INF/struts-template.tld&lt;/taglib-uri&gt;
  -   &lt;taglib-location&gt;/WEB-INF/struts-template.tld&lt;/taglib-location&gt;
  - &lt;/taglib&gt;
  -</font></pre>
  +          in reality you would only specify the taglib's that your application will 
use:
           </p>
  -          
  +
  +<pre>
  +&lt;taglib&gt;
  +  &lt;taglib-uri&gt;
  +    /WEB-INF/struts-bean.tld
  +  &lt;/taglib-uri&gt;
  +  &lt;taglib-location&gt;
  +    /WEB-INF/struts-bean.tld
  +  &lt;/taglib-location&gt;
  +&lt;/taglib&gt;
  +&lt;taglib&gt;
  +  &lt;taglib-uri&gt;
  +    /WEB-INF/struts-html.tld
  +  &lt;/taglib-uri&gt;
  +  &lt;taglib-location&gt;
  +    /WEB-INF/struts-html.tld
  +  &lt;/taglib-location&gt;
  +&lt;/taglib&gt;
  +&lt;taglib&gt;
  +  &lt;taglib-uri&gt;
  +    /WEB-INF/struts-logic.tld
  +  &lt;/taglib-uri&gt;
  +  &lt;taglib-location&gt;
  +    /WEB-INF/struts-logic.tld
  +  &lt;/taglib-location&gt;
  +&lt;/taglib&gt;
  +&lt;taglib&gt;
  +  &lt;taglib-uri&gt;
  +    /WEB-INF/struts-template.tld
  +  &lt;/taglib-uri&gt;
  +  &lt;taglib-location&gt;
  +    /WEB-INF/struts-template.tld
  +  &lt;/taglib-location&gt;
  +&lt;/taglib&gt;
  +</pre>
  +
           <p>
             This tells the JSP system where to find the tag library descriptor
             for this library (in your application's WEB-INF directory, instead of
  @@ -573,5 +620,3 @@
     </chapter>
     </body>
   </document>
  -          
  -                    
  
  
  
  1.11      +23 -21    jakarta-struts/src/doc/userGuide/building_model.xml
  
  Index: building_model.xml
  ===================================================================
  RCS file: /home/cvs/jakarta-struts/src/doc/userGuide/building_model.xml,v
  retrieving revision 1.10
  retrieving revision 1.11
  diff -u -r1.10 -r1.11
  --- building_model.xml        2001/01/23 04:08:18     1.10
  +++ building_model.xml        2001/01/23 05:06:49     1.11
  @@ -8,7 +8,7 @@
     </properties>
     
     <body>  
  -  <chapter name="Building Model Components" href="building_model">
  +  <chapter name="2. Building Model Components" href="building_model">
     
         <section name="2.1 Overview" href="overview">
           
  @@ -227,31 +227,33 @@
         </p>
         <p>
           After the datasource is defined, here is an example of establishing a 
connection 
  -        from within a Action perform method. 
  +        from within a Action perform method.
         </p>
   <pre>
  -  public ActionForward perform(ActionMapping mapping,
  -                               ActionForm form,
  -                               HttpServletRequest request,
  -                               HttpServletResponse response) {
  +public ActionForward
  +       perform(ActionMapping mapping,
  +               ActionForm form,
  +               HttpServletRequest request,
  +               HttpServletResponse response)
  +{
  +  try {
  +    javax.sql.DataSource dataSource =
  +      servlet.findDataSource(null);      
  +    java.sql.Connection myConnection =
  +      dataSource.getConnection();
  +    //do what you wish with myConnection
  +  } catch (SQLException sqle) {
  +    getServlet().log("Connection.process", sqle);
  +  } finally {
  +    //enclose this in a finally block to make
  +    //sure the connection is closed
       try {
  -      javax.sql.DataSource dataSource = servlet.findDataSource(null);      
  -      java.sql.Connection myConnection = dataSource.getConnection();
  -      //do what you wish with myConnection
  +      myConnection.close();
  +    } catch (SQLException e) {
  +      getServlet().log("Connection.close", e);
       }
  -    catch (SQLException sqle) {
  -      getServlet().log("Connection.process", sqle);
  -    }
  -    finally {
  -      //enclose this in a finally block to make
  -      //sure the connection is closed
  -      try {
  -        myConnection.close();
  -      } catch (SQLException e) {
  -        getServlet().log("Connection.close", e);
  -      }
  -    }
     }
  +}
   </pre>
         
         <p align="center">
  
  
  
  1.13      +48 -32    jakarta-struts/src/doc/userGuide/building_view.xml
  
  Index: building_view.xml
  ===================================================================
  RCS file: /home/cvs/jakarta-struts/src/doc/userGuide/building_view.xml,v
  retrieving revision 1.12
  retrieving revision 1.13
  diff -u -r1.12 -r1.13
  --- building_view.xml 2001/01/22 04:44:07     1.12
  +++ building_view.xml 2001/01/23 05:06:49     1.13
  @@ -8,7 +8,7 @@
     </properties>
     
     <body>  
  -  <chapter name="Building View Components" href="building_view">
  +  <chapter name="3. Building View Components" href="building_view">
     
         <section name="3.1 Overview" href="overview">
           
  @@ -132,10 +132,10 @@
           <code>username</code> field might look like this (in JSP):
          </p>
         
  -      <p>
  -        <code>&lt;input type="text" name="username" 
  -        value="&lt;%= loginBean.getUsername() %&gt;"></code>
  -      </p>
  +<pre>
  +&lt;input type="text" name="username"
  +      value="&lt;%= loginBean.getUsername() %&gt;"/&gt;
  +</pre>
         
         <p>
           which is difficult to type correctly, confuses HTML developers who are
  @@ -143,12 +143,12 @@
           HTML editors.  Instead, Struts provides a comprehensive facility for
           building forms, based on the Custom Tag Library facility of JSP 1.1.
           The case above would be rendered like this using Struts:
  -      </p>
  -      
  -      <p>        
  -        <code>&lt;html:text property="username"/&gt;</code>
         </p>
  -        
  +
  +<pre>        
  +&lt;html:text property="username"/&gt;
  +</pre>
  +
         <p> 
           with no need to explicitly refer to the JavaBean from which the initial
           value is retrieved.  That is handled automatically by the framework.
  @@ -170,12 +170,18 @@
             and standard JSP facilities.  Consider the following page (based on the
             example application included with Struts) named <code>logon.jsp</code>:
           </p>       
  -<pre><font size="-1">&lt;%@ page language="java" %&gt;
  -&lt;%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html" %&gt;
  -&lt;%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean" %&gt;
  -&lt;html&gt;
  +
  +<pre>
  +&lt;%@ page language="java" %&gt;
  +&lt;%@ taglib uri="/WEB-INF/struts-html.tld"
  +        prefix="html" %&gt;
  +&lt;%@ taglib uri="/WEB-INF/struts-bean.tld"
  +        prefix="bean" %&gt;
  +&lt;html:html&gt;
   &lt;head&gt;
  -&lt;title&gt;&lt;bean:message key="logon.title"/&gt;&lt;/title&gt;
  +&lt;title&gt;
  +  &lt;bean:message key="logon.title"/&gt;
  +&lt;/title&gt;
   &lt;body bgcolor="white"&gt;
   &lt;html:errors/&gt;
   &lt;html:form name="logonForm" action="logon.do"&gt;
  @@ -185,7 +191,8 @@
         &lt;html:message key="prompt.username"/&gt;
       &lt;/th&gt;
       &lt;td align="left"&gt;
  -      &lt;html:text property="username" size="16"/&gt;
  +      &lt;html:text property="username"
  +                     size="16"/&gt;
       &lt;/td&gt;
     &lt;/tr&gt;
     &lt;tr&gt;
  @@ -193,7 +200,8 @@
         &lt;html:message key="prompt.password"/&gt;
       &lt;/th&gt;
       &lt;td align="left"&gt;
  -      &lt;html:password property="password" size="16"/&gt;
  +      &lt;html:password property="password"
  +                         size="16"/&gt;
       &lt;/td&gt;
     &lt;/tr&gt;
     &lt;tr&gt;
  @@ -211,7 +219,9 @@
   &lt;/table&gt;
   &lt;/html:form&gt;
   &lt;/body&gt;
  -&lt;/html&gt;</font></pre>         
  +&lt;/html:html&gt;
  +</pre>         
  +
           <p>
             The following items illustrate the key features of form handling in 
Struts,
             based on this example:
  @@ -279,22 +289,25 @@
             page:
           </p>
             
  -        <p>
  -<pre><font size="-1">&lt;%@page language="java">
  -&lt;%@taglib uri="/WEB-INF/struts-html.tld" prefix="html">
  +<pre>
  +&lt;%@page language="java">
  +&lt;%@taglib uri="/WEB-INF/struts-html.tld"
  +       prefix="html">
   &lt;html:form action="uploadAction.do">
  -  Please Input Text: &lt;html:text property="myText">&lt;br />
  -  Please Input The File You Wish to Upload:&lt;br />
  +  Please Input Text:
  +  &lt;html:text property="myText">&lt;br/>
  +  Please Input The File You Wish to Upload:&lt;br/>
     &lt;html:file property="myFile">&lt;br />
     &lt;html:submit />
   &lt;/html:form>
  -</font></pre>
  -        </p>
  +</pre>
  +
           <p>
             The next step is to create your ActionForm bean:
           </p>
  -        <p>
  -<pre><font size="-1">import javax.servlet.http.HttpServletRequest;
  +
  +<pre>
  +import javax.servlet.http.HttpServletRequest;
   import javax.servlet.http.HttpServletResponse;
   import org.apache.struts.action.ActionForm;
   import org.apache.struts.action.ActionMapping;
  @@ -314,8 +327,8 @@
     public FormFile getMyFile() {
       return myFile;
     }
  -}</font></pre>
  -        </p>
  +}
  +</pre>
           
           <p>
             Look at the <a href="../api/index.html">javadocs</a> for FormFile to see 
the
  @@ -397,10 +410,13 @@
             offers an additional facility to validate the input fields it has 
received.
             To utilize this feature, override the following method in your ActionForm 

             class:
  -  <pre><font size="-1">public ActionErrors validate(ActionMapping mapping,
  -                              HttpServletRequest request)
  -  </font></pre>
           </p>
  +
  +<pre>
  +public ActionErrors
  +           validate(ActionMapping mapping,
  +                    HttpServletRequest request);
  +</pre>
           
           <p>
             The validate() method is called by the controller servlet after the bean
  
  
  

Reply via email to