[cvs] expresso commit by mtraum: tutorial has been updates and moved to

JCorporate Ltd jcorp at jcorporate.com
Thu Mar 17 06:15:27 UTC 2005


Log Message:
-----------
tutorial has been updates and moved to weblog example application

Removed Files:
-------------
    expresso/expresso-web/expresso/doc/images/doc/tutorial:
        image010.jpg
        image004.jpg
        image008.jpg
        image016.jpg
        image002.jpg
        image003.jpg
        image009.jpg
        image011.jpg
        filelist.xml
        image005.jpg
        image019.jpg
        image012.jpg
        image001.jpg
        image015.jpg
        image020.jpg
        image017.jpg
        image013.jpg
        image018.jpg
        image014.jpg
        image006.jpg
        image007.jpg
    expresso/expresso-web/expresso/doc:
        tutorial.html

Revision Data
-------------
Binary files expresso-web/expresso/doc/images/doc/tutorial/image003.jpg and /dev/null differ
Binary files expresso-web/expresso/doc/images/doc/tutorial/image012.jpg and /dev/null differ
Binary files expresso-web/expresso/doc/images/doc/tutorial/image007.jpg and /dev/null differ
Binary files expresso-web/expresso/doc/images/doc/tutorial/image005.jpg and /dev/null differ
Binary files expresso-web/expresso/doc/images/doc/tutorial/image004.jpg and /dev/null differ
Binary files expresso-web/expresso/doc/images/doc/tutorial/image020.jpg and /dev/null differ
Binary files expresso-web/expresso/doc/images/doc/tutorial/image009.jpg and /dev/null differ
Binary files expresso-web/expresso/doc/images/doc/tutorial/image002.jpg and /dev/null differ
Binary files expresso-web/expresso/doc/images/doc/tutorial/image018.jpg and /dev/null differ
Binary files expresso-web/expresso/doc/images/doc/tutorial/image017.jpg and /dev/null differ
Binary files expresso-web/expresso/doc/images/doc/tutorial/image014.jpg and /dev/null differ
Binary files expresso-web/expresso/doc/images/doc/tutorial/image016.jpg and /dev/null differ
--- expresso-web/expresso/doc/images/doc/tutorial/filelist.xml
+++ /dev/null
@@ -1,24 +0,0 @@
-<xml xmlns:o="urn:schemas-microsoft-com:office:office">
- <o:MainFile HRef="../tutorial.html"/>
- <o:File HRef="image001.jpg"/>
- <o:File HRef="image002.jpg"/>
- <o:File HRef="image003.jpg"/>
- <o:File HRef="image004.jpg"/>
- <o:File HRef="image005.jpg"/>
- <o:File HRef="image006.jpg"/>
- <o:File HRef="image007.jpg"/>
- <o:File HRef="image008.jpg"/>
- <o:File HRef="image009.jpg"/>
- <o:File HRef="image010.jpg"/>
- <o:File HRef="image011.jpg"/>
- <o:File HRef="image012.jpg"/>
- <o:File HRef="image013.jpg"/>
- <o:File HRef="image014.jpg"/>
- <o:File HRef="image015.jpg"/>
- <o:File HRef="image016.jpg"/>
- <o:File HRef="image017.jpg"/>
- <o:File HRef="image018.jpg"/>
- <o:File HRef="image019.jpg"/>
- <o:File HRef="image020.jpg"/>
- <o:File HRef="filelist.xml"/>
-</xml>
\ No newline at end of file
Binary files expresso-web/expresso/doc/images/doc/tutorial/image006.jpg and /dev/null differ
Binary files expresso-web/expresso/doc/images/doc/tutorial/image015.jpg and /dev/null differ
Binary files expresso-web/expresso/doc/images/doc/tutorial/image001.jpg and /dev/null differ
Binary files expresso-web/expresso/doc/images/doc/tutorial/image013.jpg and /dev/null differ
Binary files expresso-web/expresso/doc/images/doc/tutorial/image010.jpg and /dev/null differ
Binary files expresso-web/expresso/doc/images/doc/tutorial/image019.jpg and /dev/null differ
Binary files expresso-web/expresso/doc/images/doc/tutorial/image011.jpg and /dev/null differ
Binary files expresso-web/expresso/doc/images/doc/tutorial/image008.jpg and /dev/null differ
--- expresso-web/expresso/doc/tutorial.html
+++ /dev/null
@@ -1,703 +0,0 @@
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
-<html lang="en">
-<head>
-<meta http-equiv="Content-Type" content="text/html;charset=ISO-8859-1">
-<link href="/style/default.css" rel="stylesheet" type="text/css">
-<title>Expresso Tutorial: WebLog Application</title>
-<META name="robots" content="all">
-<base href="http://www.jcorporate.com">
-</head>
-
-<BODY vlink="#0000ff" alink="#cc0000" link="#0033ff" bgcolor="#ffffff" class="jc-default">
-<div class=Section1>
-  <h1 align="center">Expresso Tutorial</h1>
-  <h4 align="center">Using WebLog Application</h4>
-
-  <TABLE border="0" width="100%">
-    <TBODY>
-      <TR>
-        <TD width="14%" valign="top">
-          <H4>Version:</H4>
-        </TD>
-        <TD width="42%" valign="top">
-          <P>Expresso 5.x</P>
-
-        </TD>
-        <TD width="12%" valign="top">
-          <H4>Author:</H4>
-        </TD>
-        <TD width="32%" valign="top">
-          <P><A href="mailto:tdai at optonline.net?Subject=WebLog Tutorial">Tino Dai</A>, <A href="mailto:dlloyd at jgroup.net?Subject=WebLog Tutorial">David Lloyd</A></P>
-        </TD>
-      </TR>
-
-    </TBODY>
-  </TABLE>
-  <p class="jc-explanation">So your doing server side development?  You&#8217;ve
-    already determined that developing using a MODEL-VIEW-CONTROLLER design pattern
-    is the way to go you. Your dilemma is you are under tight time constraints
-    for your project.  Maybe even you are new to Java and feel daunted by its
-    complexity at the moment. As a seasoned developer you know that starting
-    a new application from scratch is not the best strategy in the time-to-market
-    philosophy of the real business world. You want to leverage existing code. </p>
-  <p>With advances in studio products, the ready-made web application is on the
-    horizon, where you as a software developer, will look in distaste if you
-    had to code your own security, database persistence layers, session management,
-    controller, actions, input and output, validation, and user profiling entirely
-    from scratch. Hence the reason you want to learn more about frameworks. </p>
-  <h2>Introduction</h2>
-  <p>I am presenting this tutorial because it is my view that frameworks can
-    have a steep learning curve because of their complexity.  Expresso Framework
-    for example has well over 200 classes.  So this tutorial is aimed at making
-    it easier to get going.</p>
-
-  <p>Although there are a number of architectural frameworks, I am going to present
-    this tutorial for the open source Expresso Framework ( <a
-href="http://www.jcorporate.com/">www.jcorporate.com</a>) which is a popular
-    project with a  large user base. The Expresso application has been around
-    since 1999, during which it has matured into a robust application being used
-    in both large and small companies.  The framework is based on the Jakarta
-    Struts framework, and extends it to create a full featured framework complete
-    with built-in security, MVC architecture, and a whole host of other features.</p>
-  <h2>Section I: What Comprises Expresso?</h2>
-  <p>Expresso is divided technically into for parts: database object persistence,
-    controller design, schemas, and the rest of the toolkit which involves job
-    control, utilities etc. It is essential that you understand the first three
-    parts. My tutorial will help you with this using a simple web log application.</p>
-  <h3>Database Object Persistence</h3>
-  <p>              Object to Relation mapping or O/R mapping for short is one
-    of the foundations of Expresso. All O/R mapping means is the relating of
-    relations database elements to  plain old Java objects. In Expresso, they
-    are called DBObjects. Expresso supports many of the most popular databases
-    such as Oracle, Mysql, Sybase, and SQL Server through DBObjects. This particular
-    set of  DBObjects can be found in <em>com.jcorporate.expresso.core.dbobj</em>.
-    The DBObjects work by abstracting the JDBC calls and putting the values into
-    a Java object. The DBObject provides an intermediate object for the application
-    to interact with the database. This allows for the developer to worry about
-    the application code and not have to directly manage the connection pool
-    and/or the JDBC calls. From the DBObject class, there are several subclasses
-    that are worth mentioning. </p>
-
-  <table width="100%" border="0">
-    <tr valign="top">
-      <td bgcolor="#91acdb"><span class="jc-default">SecureDBObject:</span>  </td>
-      <td>&nbsp;</td>
-      <td class="jc-default">DBObjects that have Expresso security built right in</td>
-    </tr>
-    <tr valign="top">
-
-      <td bgcolor="#91acdb" class="jc-default">MediaDBObject: </td>
-      <td>&nbsp;</td>
-      <td class="jc-default"> DBObjects that allows non-text (or blobs) field in the DBObject's
-        fields</td>
-    </tr>
-    <tr valign="top">
-      <td bgcolor="#91acdb" class="jc-default">RowDBObject:</td>
-      <td>&nbsp; &nbsp; &nbsp;</td>
-
-      <td class="jc-default">DBObjects that allow for row level locking (instead of table level
-        locking as with the regular DBObjects)</td>
-    </tr>
-  </table>
-  <p>Of the three DBObjects above, the tutorial will be using SecuredDBObject
-    heavily in the next section. The next section will explain how to manipulate
-    the DBObjects using controllers.</p>
-  <h3>Controller</h3>
-  <p>                     The engine of Expresso is the controller and can basically
-    be thought of as a finite state machine with inputs, outputs, transitions,
-    and blocks with security built right in. The controller will migrate from
-    state to state performing the actions of that state. The controller will
-    use inputs to take values from external sources such as keyboard. It will
-    utilize outputs to convey information back to the user. The controller relies
-    on transitions to move from state to state. The block serves as a container
-    in which a controller can store many inputs, outputs, and transitions. This
-    makes for easier coding and maintenance of the code. Expresso has  security
-    that filters down into the controller. This permits or denies access to one
-    or more of the controllers' states. As with the DBObjects, Expresso has a
-    set of controllers  that can be used with little or no modification. DBMaint
-    is one of these pre-made controllers and can be found in com.jcorporate.expresso.services.
-    This controller will be used heavily in the tutorial to provide the basic
-    Add, Delete, Update, and Search functions for any SecuredDBObject. I choose
-    to use the DBMaint for two reasons: first to not reinvent the wheel and second
-    to provide you with tools to accelerate your own development.  </p>
-
-  <h3>Schema</h3>
-  <p>               The schema in Expresso can be though as the &#8220;announcer&#8221; for
-    the application. The schema class is called when the application is brought
-    into the Expresso environment. In this class, two sections will be focused
-    on. The first section is the constructor which will encapsulate all the components
-    to be added such as DBObjects, controllers, and jobs.  The other section
-    is the different security parameters on each component, or in other words:
-    who gets access to what and  what kind of access.</p>
-  <p>               The three concepts described above: DBObjects, controllers,
-    and Schema should give you an understanding of the mechanisms behind Expresso.
-    I will use this as a foundation to explain my code.</p>
-  <h2>Section II: How Do I Get Started?</h2>
-  <p>              I talked about what Expresso is and a sprinkling of theory
-    behind it. I will be applying the theory to working code in this section
-    to give you an illustration of the power of Expresso via a Weblog application.
-    First, we will look at the complete architecture of the Weblog (as shown
-  below:</p>
-
-  <p align="center"><img width=450 src="/images/doc/tutorial/image002.jpg"></p>
-  <p><span class="jc-label">Diagram #1:<br>
-              The picture gives a view of how all components are tied together.
-  The controllers access the DBObject (in this case SecuredDBObjects) and push
-  the resulting controller values out to the JSPs. So, how does one write the code
-  to do this? </span>  <br clear=ALL>
-  </p>
-  <p>                     The DBObjects are the foundation on which Expresso
-    is built. SecuredDBObjects are used in this tutorial for their security properties.
-    So, what does a DBObject look like?  Below is two code snippet from the Entry
-    DBObject of the declaration and setupFields method.</p>
-  <p class="jc-code">&nbsp;&nbsp;&nbsp;&nbsp; public class Entry extends SecuredDBObject {              (1)</p>
-
-  <p>(1) The declaration of this class extends
-  the SecuredDBObject class</p>
-  <p class="jc-code">     protected synchronized void setupFields ()
-  throws DBException{   <br>
-  &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;(1) setTargetTable(&quot;WLOGENTRY&quot;);                        <br>
-  &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;(2) addField(FLD_ENTRY_ID,&quot;auto-inc&quot;,
-  0, false, &quot;Entry
-    ID&quot;);<br>
-
-	&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;(3) addField(FLD_USER,&quot;int&quot;,30,false,&quot;User
-	Name&quot;);         <br>
-&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;(4) addField(FLD_DATE,&quot;datetime&quot;,0,false,&quot;Date
-    and Time&quot;);    <br>
-&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;(5) addField(FLD_TITLE,&quot;varchar&quot;,30,false,&quot;Title&quot;); <br>
-
-&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;(6) addField(FLD_ENTRY,&quot;text&quot;,0,true,&quot;Entry&quot;);  <br>
-&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;(7) setReadOnly(FLD_USER); <br>
-&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;(8) setReadOnly(FLD_DATE); <br>
-&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;(9) addKey(FLD_ENTRY_ID);  
-  <p class="jc-code">    }</p>
-  <p class="jc-label">(1) The <span class="jc-code">setTargetTable</span> will tell which database table this particular DBObject
-    will be working on</p>
-
-  <p class="jc-label">(2-6) The <span class="jc-code">addField</span> adds a field to the database. The syntax of the addField
-    is </p>
-  <p class="jc-code">addField(Field name, type, max characters, whether or not the field can
-    be empty,Field description)</p>
-  <p class="jc-label">(7-8)The <span class="jc-code">setReadOnly</span> field allows the DBMaint by pass that field. It's a
-    little confusing now, but it will become more clear</p>
-  <p class="jc-label">(9) The <span class="jc-code">addKey</span> allows a field to become the primary key in the database.</p>
-
-  <p>The DBObject will translate into a table like the one shown below below.
-    I used mySQL in this tutorial for illustration.</p>
-  <p><span class="jc-code">mysql&gt; desc WLOGENTRY</span>;</p>
-  <p class="jc-code">+---------------+-------------+------+-----+---------------------+-------+</p>
-  <p class="jc-code">| Field         | Type        | Null | Key | Default             |
-    Extra |</p>
-  <p class="jc-code">+---------------+-------------+------+-----+---------------------+-------+</p>
-
-  <p class="jc-code">| EntryID       | int(11)     |      | PRI | 0                   |       |</p>
-  <p class="jc-code">| UserLoginName | int(30)     |      |     | 0                   |       |</p>
-  <p class="jc-code">| EntryDate     | datetime    |      |     | 0000-00-00 00:00:00 |       |</p>
-  <p class="jc-code">| Title         | varchar(30) |      |     |                     |       |</p>
-  <p class="jc-code">| EntryText     | text        | YES  |     | NULL                |       |</p>
-  <p class="jc-code">+---------------+-------------+------+-----+---------------------+-------+</p>
-
-  <p class="jc-code">5 rows in set (0.00 sec)</p>
-  <p>              In the next paragraph, there will be controller code illustrating
-    the use for both business logic and to manipulate DBObjects.</p>
-  <p>              The controllers are the engine of Expresso. I will be using
-    the <span class="jc-code">DBMaint</span> and the <span class="jc-code">SimpleLogin</span> controllers which are pre-made controllers.
-    The tutorial will be extending those. There will be several code snippets
-    to illustrate the mechanisms behind a controller. The first code snippet
-    shows the constructor. The controller's constructor sets up the different
-    states within the controller.</p>
-  <p>              <span class="jc-code">public WlogLogin() {<br>
-
-         super();                                                    (1)<br>
-         //  some other stuff here ...<br><br>
-
-         State promptCreate = new State(&quot;addUser&quot;,&quot;Adding Users...&quot;);    (2)<br>
-         addState(promptCreate);                                  (3)<br>
-         State processCreate = new State(&quot;processNewUser&quot;,&quot;Processing New Users&quot;);<br>
-         addState(processCreate);<br>
-       }</span>
-  <P align="center"> <img width=575 height=256 src="/images/doc/tutorial/image004.jpg" ></P>
-  <p>(1)The super will initialize the base class; initializing any states, security, etc. as needed.</p>
-  <p>(2)A new state called <span class="jc-code">addUser</span> is being created.</p>
-
-  <p>(3)The <span class="jc-code">addState</span> adds the new state to the possible states that this particular
-    controller can transition to</p>
-  <p>Once the constructor has been set up, the actual states need to be set up.  But
-    before leaving this topic of controller constructors, there is a critical
-    method called <span class="jc-code">addDefaultState</span> which must be  in the constructor. Its purpose
-    is to provide a default state to transition to if none is given eg.  <a
-href="http://localhost:8080/weblog/WlogLogin.do">http://localhost:8080/weblog/WlogLogin.do</a>.
-    Below is a state from the <span class="jc-code">WlogLogin</span> class.</p>
-
-  <p>       <span class="jc-code">protected void runAddUserState(ControllerRequest req, ControllerResponse
-    res) throws ControllerException {<br>
-       res.addInput(new Input(&quot;UserName&quot;,&quot;User Name&quot;));<br>
-       res.addInput(new Input(&quot;Password&quot;,&quot;Password&quot;));<br>
-       res.addInput(new Input(&quot;RePassword&quot;,&quot;Re Password&quot;));<br>
-
-       res.addInput(new Input(&quot;Email&quot;,&quot;Email Address&quot;));<br>
-       res.addTransition(new Transition(&quot;myButton&quot;, &quot;Add User&quot;, WlogLogin.class, &quot;processNewUser&quot;));<br>
-    }</span><br clear=all style='page-break-before:always'>
-&nbsp; </p>
-  <p>The method names must be in the following fashion for the method to be a
-    valid state.</p>
-
-  <h5 align=center style='text-align:center;'>Run + Controller State's Name +
-    State</h5>
-  <p>Anything that doesn't follow this pattern is just another method. Also like
-    the Java convention, the controller name should be <span class="jc-code">runExampleControllerState</span>    with the first letter of the second word capitalized in this case Example.
-    The <span class="jc-code">ControllerRequest</span> and <span class="jc-code">ControllerResponse</span> are parameters that hold values
-    between the states. In the above code, the res parameter being assigned news
-    values: 4 inputs and 1 one transition. In diagram #2, after a state is processed,
-    it is passed to the jsp to render. If there is no jsp, then Expresso uses
-    it's own rendering system. In this case, we are using the Expresso rendering
-    system, and looks like so:</p>
-  <p>The picture shows the inputs as text boxes and the transition as a button.
-    The next state is the <span class="jc-code">runProcessNewUserState</span> (see above code: <span class="jc-code">addTransition</span>    statement). The <span class="jc-code">runAddUserState</span> is a less complex controller. The <span class="jc-code">runListBothState</span>    controller is a more complex controller.</p>
-
-  <p>              The <span class="jc-code">listBoth</span> controller is part of the CommentDBMaint class.
-    The <span class="jc-code">CommentDBMaint</span> class is a extension of the pre-made DBMaint.</p>
-  <p class="jc-code">protected void runListBothState(ControllerRequest
-    req, ControllerResponse res) throws ControllerException, DBException {                  (1)<br>
-    ArrayList commentArray = new ArrayList();                             <br>
-    Entry entryDBObj = new Entry();                   (2)<br>
-
-    Comment commentDBObj = new Comment();             (3)<br>
-    entryDBObj.setField(FLD_ENTRY_ID,req.getParameter(&quot;entryid&quot;));
-    (4)<br>
-    entryDBObj.find();                                (5)</P>
-  <p>(1) Here again the reader sees an ordinary method become a state with the
-    <span class="jc-code">ControllerRequest</span> and <span class="jc-code">ControllerResponse</span> parameters</p>
-
-  <p>(2-3) In the theory section, it was mention that DBObjects could be treated
-    like another object, and here the Entry and Comment DBObjects are being instantiated </p>
-  <p>(4) This <span class="jc-code">setField</span> allows the field <span class="jc-code">EntryID</span> in the Entry DBObject to take
-    on the value of <span class="jc-code">req.getParamete(&#8220;entryid&#8221;)</span></p>
-  <p>(5) The <span class="jc-code">entryDBObj.find()</span> will go into the underlying database and retrieve
-    all of the entries. The find method can be limited by setting one of more
-    fields within the DBObject to a certain value. In this cases, the find will
-    only return the records that match the value in the <span class="jc-code">EntryID</span> field.</p>
-
-  <p class="jc-code">  Block b1 = new Block(&quot;b1&quot;);                                 (6)<br>
-    b1.add(new Output(FLD_USER,entryDBObj.getField(FLD_ENTRY_ID)));
-  (7)<br>
-    b1.add(new Output(FLD_DATE,entryDBObj.getField(FLD_USER)));     (8)<br>
-    b1.add(new Output(FLD_TITLE,entryDBObj.getField(FLD_TITLE)));   (9)<br>
-    b1.add(new Output(FLD_ENTRY,entryDBObj.getField(FLD_ENTRY)));   (10)<br>
-
-    res.addBlock(b1);                                           (11)<br>
-  <p>(6-11) Here we see an example of a creation of a new block, adding of the
-    new components to the block, and adding of the block to the <span class="jc-code">ControllerResponse</span>    parameters.   </p>
-  <p>   <span class="jc-code">commentDBObj.setField(CMT_ENTRY_REF,req.getParameter(&quot;entryid&quot;));(12)<br>
-  commentArray = commentDBObj.searchAndRetrieveList();         (13)<br>
-
-  Iterator e = commentArray.iterator();                        (14)<br>
-  Comment commentTemp = new Comment();                         (15)<br>
-  Block b2 = new Block(&quot;b2&quot;);                                  (16)<br>
-  while ( e.hasNext() ) {                                      (17)<br>
-     commentTemp = (Comment)e.next();                          (18)<br>
-     Block oneRow = new Block(&quot;oneRow&quot;);                       (19)<br>
-     oneRow.add(new Output(commentTemp.getField(CMT_USER)));   (20)<br>
-
-     oneRow.add(new Output(commentTemp.getField(CMT_DATE)));   (21)<br>
-     oneRow.add(new Output(commentTemp.getField(CMT_TITLE)));  (22)<br>
-     oneRow.add(new Output(commentTemp.getField(CMT_COMMENT)));(23)<br>
-     b2.add(oneRow);                                           (24)<br>
-     }<br>
-  res.addBlock(b2);                                           (25)</span><br>
-  <p>(12-25) This block of code will retrieve all of the rows pertaining to the
-    particular Entry DBObjects that was retrieved above. The readers sees the
-    <span class="jc-code">searchAndRetrieveList</span> method. This retrieve all the rows in the database
-    and transfers them to an <span class="jc-code">ArrayList</span>. The <span class="jc-code">ArrayList</span> is then iterated to to
-    retrieve each row's information. What is interesting about this snippet of
-    code is there is a series of blocks (oneRow) inside of another block (b2).
-    In a later section, it will be illustrated how to extract the information
-    from a block within a block</p>
-
-  <p>  <span class="jc-code">Block transBlock = new Block(&quot;transBlock&quot;);                 (26)<br>
-  Transition b3 = new Transition(&quot;listEntry&quot;,&quot;List Weblog
-    \   Entry&quot;,com.jcorporate.demo.weblog.controller.EntryDBMaint.class,&quot;List&quot; (27)<br>
-
-  b3.addParam(&quot;dbobj&quot;,com.jcorporate.demo.weblog.dbobj.Entry.class.getName());(28)<br>
-  transBlock.add(b3);                                         (29)<br>
-  b3 = new Transition(&quot;addEntry&quot;,&quot;Add Weblog \ <br>
-    Entry&quot;,com.jcorporate.demo.weblog.controller.EntryDBMaint.class,&quot;Add&#8221;);(30)<br>
-
-  b3.addParam(&quot;dbobj&quot;,com.jcorporate.demo.weblog.dbobj.Entry.class.getName());(31)<br>
-  transBlock.add(b3);                                         (32)<br>
-  b3 = new Transition(&quot;logout&quot;,&quot;Logout&quot;, \<br>
-   com.jcorporate.demo.weblog.controller.WlogLogin.class, &quot;processLogout&quot;);
-    (33)<br>
-
-  transBlock.add(b3);                                         (34)<br>
-  res.addBlock(transBlock);                                   (35)<br>
-  }</span></p>
-  <p>(26-35) This snippet is creating a block that will have a series of transition
-    components. The transition will have a syntax of:</p>
-  <p class="jc-code">transition(name,description,what controller to transition to, what controller
-    state to transition to)</p>
-  <p>Also the there is an <span class="jc-code">addParam</span>. This allows one to tack on parameters to
-    the transition. In this case it is the DBObject that the state will be interacting
-    with. Without the <span class="jc-code">addParam</span>, the transition will throw an error because it
-    doesn't know where to transition to. And finally, the block is added to the
-    <span class="jc-code">ControllerResponse res</span>.</p>
-
-  <p>                     In the diagram #2, there is a <span class="jc-code">WeblogSchema</span> class. The
-    <span class="jc-code">WeblogSchema</span> classes acts as a registration mechanism to make Expresso aware
-    of the different components in the target application, and a way to setup
-    any other sort of initialization, in this case security.  Below we see a
-    snippet of code that allows, in this case, two controllers and two DBObjects
-    to be added.</p>
-  <p>       <span class="jc-code">public WeblogSchema() {<br>
-       super();<br>
-       addDBObject(com.jcorporate.expresso.demo.weblog.dbobj.Entry.class);<br>
-
-       addDBObject(com.jcorporate.expresso.demo.weblog.dbobj.Comment.class);<br>
-       addController(com.jcorporate.expresso.demo.weblog.controller.EntryDBMaint.class);<br>
-       addController(com.jcorporate.expresso.demo.weblog.controller.CommentDBMaint.class);<br>
-       addController(com.jcorporate.expresso.demo.weblog.controller.WlogLogin.class);<br>
-     }</span></p>
-  <p>The mechanism for adding the DBObjects, controllers, and other various items
-    is done by calling the appropriate method from the class constructor (<span class="jc-code">WeblogSchema</span>).
-    The methods have a standard name: add + component type for example: to add
-    a DBObject, it is addDBObject(classname) .  Schema class's <span class="jc-code">otherSetup</span> method
-    is used to setup security for the DBObjects and the controllers. Below is
-    part of the <span class="jc-code">otherSetup</span> method found in the <span class="jc-code">WeblogSchema</span>.</p>
-
-  <p>     <span class="jc-code">  public void otherSetup(String DBName) throws
-      DBException {<br>
-      UserGroup user = new UserGroup();<br>
-      String oneString;<br>
-      user.setRequestingUid(SecuredDBObject.SYSTEM_ACCOUNT);  (1)<br>
-      user.setDataContext(this.getDBName());                  (2)<br>
-      user.setField(&quot;GroupName&quot;,WLOG_ADM);                    (3)<br>
-
-      user.setField(&quot;Descrip&quot;,&quot;Weblog II Admin&quot;);             (4)</span></p>
-  <p>(1)This gives who is request access to the database</p>
-  <p>(2)Specifies the database is being requested</p>
-  <p>(3)Will set the field <span class="jc-code">GroupName</span> to <span class="jc-code">WeblogAdm</span></p>
-
-  <p>(4)Will set the field <span class="jc-code">Descript</span> to &#8220;<span class="jc-code">Weblog
-  II Admin</span>”</p>
-  <p><span class="jc-code">      user.addIfNeeded();                                     (5)<br>
-      user.clear();                                           (6)</span><br>
-  <p>(5)The <span class="jc-code">addIfNeeded</span> instructs the DBObject to add the record only if needed
-    or in other words only if the record doesn't already exist</p>
-
-  <p>(6)The clear method will clear all of the <span class="jc-code">setField</span> parameters and allow
-    the DBObject to act as if it was just instanshiated </p>
-  <p>      <span class="jc-code">user.setField(&quot;GroupName&quot;,WLOG_USER);<br>
-      user.setField(&quot;Descrip&quot;,&quot;Weblog II User&quot;);<br>
-
-      user.addIfNeeded();<br>
-      GroupMembers group = new GroupMembers();<br>
-      group.setField(&quot;GroupName&quot;,WLOG_ADM);<br>
-      group.setField(&quot;ExpUid&quot;,&quot;4&quot;);<br>
-      group.addIfNeeded();<br>
-      group.clear();<br>
-
-      group.setField(&quot;GroupName&quot;,WLOG_USER);<br>
-      group.setField(&quot;ExpUid&quot;,&quot;4&quot;);<br>
-      group.addIfNeeded();<br>
-      GroupNest gnest = new GroupNest();<br>
-      gnest.setField(&quot;GroupName&quot;,WLOG_ADM);<br>
-
-      gnest.setField(&quot;MemberOf&quot;,WLOG_USER);<br>
-      gnest.addIfNeeded();</span></p>
-  <p>Here again DBObjects again come into play. The first DBObject that the reader
-    encounters is <span class="jc-code">UserGroup</span>. </p>
-  <p>This was just a snippet of the entire <span class="jc-code">otherSetup</span> method, to see all of the
-    DBObjects are used, please refer to the source code located on the Jcorporate
-    site.</p>
-
-  <p>              To display to a web browser, there are a multitude of languages/methods
-    that one can use. In this case, JSPs are used to render. From <span class="jc-code">CommentDBMaint's
-    listBoth</span> state:</p>
-  <p>                    <span class="jc-code">Block b1 = <b>new</b> Block(&quot;b1&quot;);<br>
-       b1.add(<b>new</b> Output(FLD_USER,entryDBObj.getField(FLD_ENTRY_ID)));<br>
-
-       b1.add(<b>new</b> Output(FLD_DATE,entryDBObj.getField(FLD_USER)));<br>
-       b1.add(<b>new</b> Output(FLD_TITLE,entryDBObj.getField(FLD_TITLE)));<br>
-       b1.add(<b>new</b> Output(FLD_ENTRY,entryDBObj.getField(FLD_ENTRY)));<br>
-       res.addBlock(b1);</span></p>
-
-  <p >How does one extract this information
-    from the b1 block? In the <span class="jc-code">cview.jsp</span>:</p>
-  <p >                    <span class="jc-code">&lt;table border=&quot;1&quot; width=&quot;50%&quot;&gt; <br>
-           &lt;tr&gt;<br>
-
-               &lt;logic:iterate
-    id=&quot;oneCol&quot; property=&quot;b1&quot;&gt;         (1)<br>
-                  &lt;td&gt;&lt;bean:write
-    name=&quot;oneCol&quot;/&gt;&lt;/td&gt; (2)<br>
-
-               &lt;/logic:iterate&gt;                         (3)<br>
-           &lt;/tr&gt;<br>
-       &lt;/table&gt;</span></p>
-  <p>(1)The JSP code is setting the b1 block created in the CommentDBMaint's
-    <span class="jc-code">listBoth</span> state to the <span class="jc-code">oneCol</span> using the &lt;logic:iterate&gt; tag. </p>
-
-  <p>(2)After the <span class="jc-code">oneCol</span> variable has been set, it  can be written out to the
-    web browser using the <span class="jc-code">&lt;bean:write&gt;</span> tag. It is interesting to note that
-    the <span class="jc-code">&lt;bean:write&gt;</span> tag can handle input, outputs, transitions, as well
-    as blocks.</p>
-  <p>(3)Closing the <span class="jc-code">&lt;logic:iterate&gt;</span> block</p>
-
-  <p>Below is a more complex example: a block within a block. Again, there is
-    a code snippet from the CommentDBMaint DBObj.</p>
-  <p>       <span class="jc-code">Block b2 = <b>new</b> Block();<br>
-          <b>while</b> ( e.hasNext()
-    ) {<br>
-            commentTemp = (Comment)e.next();<br>
-
-            Block oneRow = <b>new</b> Block(&quot;oneRow&quot;);<br>
-            oneRow.add(new Output(commentTemp.getField(CMT_USER)));<br>
-            oneRow.add(new Output(commentTemp.getField(CMT_DATE)));<br>
-            oneRow.add(newOutput(commentTemp.getField(CMT_TITLE)));<br>
-            oneRow.add(new Output(commentTemp.getField(CMT_COMMENT)));<br>
-            b2.add(oneRow);          <br>
-
-          }<br>
-       res.addBlock(b2);</span></p>
-  <p >And another piece of the <span class="jc-code">cview.jsp:</span></p>
-  <p >                    <span class="jc-code">&lt;table border=&quot;1&quot; width=&quot;50%&quot;&gt; <br>
-
-        &lt;logic:iterate id=&quot;oneRow&quot; property=&quot;b2&quot;&gt;       (1)<br>
-           &lt;tr&gt;<br>
-             &lt;logic:iterate id=&quot;oneCol&quot; name=&quot;oneRow&quot;&gt;  (2)<br>
-
-               &lt;td&gt;&lt;bean:write name=&quot;oneCol&quot;/&gt;&lt;/td&gt;     (3)<br>
-             &lt;/logic:iterate&gt;                           (4)<br>
-           &lt;/tr&gt;<br>
-        &lt;/logic:iterate&gt;                               (5)<br>
-
-      &lt;/table&gt;</span></p>
-  <p >(1)The b2 block is set to oneRow
-    using the <span class="jc-code">&lt;logic:iterate&gt;</span></p>
-  <p >(2)Remember that b2 has a block
-    inside of it so there is another <span class="jc-code">&lt;logic:iterate&gt;</span> to extract the information
-    from <span class="jc-code">oneRow</span>.</p>
-  <p >(3)After the information has been
-    extract, it can be pushed out to the web browser with the <span class="jc-code">&lt;bean:write&gt;</span> tag</p>
-
-  <p >(4)This  <span class="jc-code">&lt;/logic:iterate&gt;</span> closes
-    the inner <span class="jc-code">&lt;logic:iterate&gt;</span> tag</p>
-  <p >(5)This  <span class="jc-code">&lt;/logic:iterate&gt;</span> closes
-    the outer <span class="jc-code">&lt;logic:iterate&gt;</span> tag</p>
-
-  <p >This is how the application gets
-    the information from the controllers to the web browser using the JSPs.</p>
-  <p>              The final piece of the application is the <span class="jc-code">weblog-config.xml</span>    file located in /WEB-INF/config/ directory. This will link together the different
-    URIs to the different controllers and states that are available to the user. </p>
-  <p>    <span class="jc-code"> &lt;?xml version=&quot;1.0&quot; encoding=&quot;ISO-8859-1&quot;?&gt;<br>
-
-       &lt;!DOCTYPE struts-config PUBLIC &quot;-//Apache Software \ <br>
-       Foundation//DTD Struts Configuration 1.0//EN&quot;<br>
-       &quot;http://jakarta.apache.org/struts/dtds/struts-config_1_0.dtd&quot;&gt;<br>
-       &lt;!-- For New Weblog --&gt;<br>
-       &lt;struts-config&gt;<br>
-            &lt;global-forwards&gt;<br>
-
-            &lt;forward name=&quot;logon&quot; path=&quot;/weblog/WlogLogin.do&quot;/&gt;<br>
-         &lt;/global-forwards&gt;<br>
-         &lt;action-mappings&gt;<br>
-            &lt;action path=&quot;/weblog/EntryDBMaint&quot; <br>
-
-            type=&quot;com.jcorporate.expresso.demo.weblog.controller.EntryDBMaint&quot; <br>
-            name=&quot;default&quot; scope=&quot;request&quot; validate=&quot;false&quot;&gt;<br>
-              &lt;forward name=&quot;List&quot; \<br>
-
-              path=&quot;/expresso/components/weblog/view.jsp&quot;/&gt;<br>
-              &lt;forward name=&quot;Add&quot; \<br>
-              path=&quot;/expresso/components/weblog/add.jsp&quot;/&gt;<br>
-              &lt;forward name=&quot;AddUpdate&quot; \<br>
-
-              path=&quot;/expresso/components/weblog/redirect.jsp&quot;/&gt;<br>
-            &lt;/action&gt;<br>
-            &lt;action path=&quot;/weblog/CommentDBMaint&quot; <br>
-            type=&quot;com.jcorporate.expresso.demo.weblog.controller.CommentDBMaint&quot; <br>
-            name=&quot;default&quot; scope=&quot;request&quot; validate=&quot;false&quot;&gt;<br>
-
-              &lt;forward name=&quot;listBoth&quot;<br>
-              path=&quot;/expresso/components/weblog/cview.jsp&quot;/&gt;<br>
-              &lt;forward name=&quot;Add&quot;<br>
-              path=&quot;/expresso/components/weblog/cadd.jsp&quot;/&gt;<br>
-
-              &lt;forward name=&quot;AddUpdate&quot;<br>
-              path=&quot;/expresso/components/weblog/credirect.jsp&quot;/&gt;<br>
-            &lt;/action&gt;<br>
-            &lt;action path=&quot;/weblog/WlogLogin&quot;<br>
-            type=&quot;com.jcorporate.expresso.demo.weblog.controller.WlogLogin&quot; name=&quot;default&quot; <br>
-
-            scope=&quot;request&quot; validate=&quot;false&quot;&gt;                  (1)</span></p>
-  <p>(1)This block of XML code states that if a URI comes in with the WlogLogin.do
-    (in this case <a
-href="http://localhost:8080/weblog/WlogLogin.do">http://localhost:8080/weblog/WlogLogin.do</a>)
-    then use the controller com.jcorporate.expresso.demo.weblog.controller.WlogLogin.
-    If no state is given, then class will find it's default state and proceed
-    to that one.</p>
-  <p class="jc-code">              &lt;forward name=&quot;promptLogin&quot; \ <br>
-
-                path=&quot;/expresso/components/weblog/login.jsp&quot;/&gt;    (2)</p>
-  <p>(2)The xml code's forward name refers to the state in that controller. In
-    this case, the state would be promptLogin. And after performing that state's
-    instructions, it will be passed to the /expresso/components/weblog/login.jsp
-    for rendering.</p>
-  <p class="jc-code">              &lt;forward name=&quot;processLogin&quot;  \<br>
-                path=&quot;/expresso/jsp/register/redirect.jsp&quot;/&gt;  <br>
-
-                &lt;!--    &lt;forward name=&quot;processLogout&quot; \<br>
-                path=&quot;/expresso/jsp/register/logout.jsp&quot;/&gt; --&gt;<br>
-                &lt;forward name=&quot;promptChangePassword&quot;<br>
-
-                path=&quot;/expresso/jsp/register/change.jsp&quot;/&gt;<br>
-                &lt;forward name=&quot;processChangePassword&quot;<br>
-                path=&quot;/expresso/jsp/register/status.jsp&quot;/&gt;<br>
-                &lt;forward name=&quot;emailValidate&quot;<br>
-
-                path=&quot;/expresso/jsp/register/status.jsp&quot;/&gt;<br>
-                &lt;forward name=&quot;promptSendPassword&quot;<br>
-                path=&quot;/expresso/jsp/register/sendPassword.jsp&quot;/&gt;<br>
-                &lt;forward name=&quot;processSendPassword&quot;<br>
-
-                path=&quot;/expresso/jsp/register/status.jsp&quot;/&gt;<br>
-              &lt;/action&gt;<br>
-           &lt;/action-mappings&gt;<br>
-         &lt;/struts-config&gt;</p>
-
-  <p>For each controller in his/her application, there must be a action block
-    like the one given above. Without it, the Expresso application will not run.</p>
-  <br clear=all
-style='page-break-before:always'>
-  <h2>Section III: Deploying the Application</h2>
-  <p>              The Execution section will cover the installation, security,
-    and the day to day operations of the Expresso Weblog. The installation of
-    the Weblog starts with the downloading of the weblog.war package. After one
-    has downloaded the package, the reader should place it in the webapps directory of the container or otherwise cause
-    it to be deployed in the container.  If you are given the choice to have this application shared, 
-    you will probably want to <b>not</b> do so as it is preferable to keep the database separate from any other expresso
-    implementation.  In this tutorial, the author uses the Jakarta Tomcat
-    5.0.5 as the web container. </p>
-  <p>              A word of warning before we move on. The <a
-href="http://localhost:8080/Expresso">http://localhost:8080/Expresso</a> prefix
-    works for my environment because my webroot is /Expresso. If you decide to
-    use the Expresso complete package, to get to the main page, it would be <a href="http://localhost:8080/expresso/frame.jsp">http://localhost:8080/expresso/frame.jsp</a> instead
-    of <a href="http://localhost:8080/Expresso/expresso/frame.jsp">http://localhost:8080/Expresso/expresso/frame.jsp</a>.
-    Please keep that in mind as you go through the tutorial.</p>
-
-  <p>This is the standard architecture for all Expresso applications. The WeblogSchema,
-    in the com.jcorporate.expresso.demo.weblog package, is the key to bringing the
-application under the Expresso environment. The steps are:</div>
-<ol>
-  <li>
-    <div class=Section1>Go to: http://&lt;where web container is located&gt;/Expresso/expresso/frame.jsp. <br>
-      <br>
-      I will be using <a
-href="http://localhost:8080/Expresso/expresso/frame.jsp">http://localhost:8080/Expresso/expresso/frame.jsp</a> in
-      this tutorial. (If you haven't logged in yet, then click on the login icon
-      and log in as Admin)<br>
-
-      <br>
-      <img width=540 height=360 src="/images/doc/tutorial/image006.jpg"> <br>
-    </div>
-  </li>
-  <li>
-    <div class=Section1>
-      <div class=Section1>The Application page will appear in the right hand
-        frame. We will be using the Component Manager rather that the Registered
-        Schema and Setup/Create Database route. Click on the Run Component Manager
-        in the right frame. <br>
-
-        <br>
-        <img width=576 height=500 src="/images/doc/tutorial/image008.jpg"><br>
-      </div>
-    </div>
-  </li>
-  <li> You will be brought to the Component Manager Page. Click on the Add New
-    Component button in the right hand frame.<br>
-    <br>
-    <img width=557 height=483 src="/images/doc/tutorial/image010.jpg"><br>
-
-  </li>
-  <li>In the text field, the reader would type: com.jcorporate.expresso.demo.weblog.WeblogSchema and
-    click on Install Component. This will register the schema, build the tables
-    in the underlying database, and setup security on the DBObjects and the controllers
-    in the Expresso environment. <br>
-    <br>
-    <img width=557 height=483 src="/images/doc/tutorial/image012.jpg"><br>
-    <br>
-    <div class=Section1>Note: The WlogAdmin user is the administrator for the
-      Weblog Application. The WlogAdmin user is generated in the Weblog installation.
-      It's default password is default . Please remember to change it.<br>
-
-    </div>
-  </li>
-  <li>To check if the Application is registered: Enter in the following in the
-    Address field.<br>
-    <br>
-    <img width=575 height=271 src="/images/doc/tutorial/image014.jpg"><br>
-  </li>
-  <li>From that, the reader can login or he/she can choose to view the entries
-    without logging in.
-    <div class=Section1>After logging in, the following menu will appear.<br>
-
-      <br>
-      <img width=556 height=238 src="/images/doc/tutorial/image016.jpg"> <br>
-    </div>
-  </li>
-  <li>
-    <div class=Section1>If the reader clicks on the List:</div>
-    <br>
-    <img width=551 height=311 src="/images/doc/tutorial/image018.jpg"><br>
-
-    This is the listing of the entries. The URI that was called was: <a
-href="http://localhost:8080/Expresso/EntryDBMaint.do?state=List&amp;dbobj=com.jcorporate.expresso.demo.weblog.dbobj.Entry">http://localhost:8080/Expresso/EntryDBMaint.do?state=List&amp;dbobj=com.jcorporate.expresso.demo.weblog.dbobj.Entry<br>
-    <br>
-    </a>
-    <div class=Section1>When the web browser calls a specific URI like this,
-      the Expresso framework checks the wlog-config.xml file to see if there
-      is any jsp associated with this. In this case,  there is a view.jsp associated
-      with this state. The view.jsp will render the EntryDBMaint's list states
-      output.</div>
-    <br>
-  </li>
-  <li>
-
-    <div class=Section1>If the reader clicks on Add in #9, he/she will see this:<br>
-      <br>
-      <img width=396 height=415 src="/images/doc/tutorial/image020.jpg"><br>
-      <br>
-      Unlike the one above, this has no jsp rendering associated with it. Instead,
-      Expresso has its own rendering system. </div>
-  </li>
-</ol>
-<div class=Section1>
-  <h2>Conclusion</h2>
-
-  <p>This wraps up the Expresso Weblog tutorial. In this tutorial, the author
-    went over the theory, coding, and the execution of the Expresso Weblog. And
-    in this tutorial, the author has given the tools to accelerate production
-    such as the DBObjects and the built-in security within the Expresso environment.
-    From here, if the reader is interested in delving more into the Expresso
-    framework, there is a whole host of documents on the Expresso site (<a
-href="http://www.jcorporate.com/">http://www.jcorporate.com</a>) going into specific
-    detail about the different facets of the framework. </p>
-  <p>If the reader has any feedback: please email me at: <a href="mailto:tdai at optonline.net">tdai at optonline.net</a> or <a href="mailto:dlloyd at jgroup.net">dlloyd at jgroup.net</a></p>
-  <p>Tino Dai is a development project manager.</p>
-  <p>David Lloyd is an Expresso Core Contributor and provides expert consulting and development contracts through Jcorporate's Jgroup Services.</p>
-  <DIV align="center"> 
-    <hr>
-  </DIV>
-
-  <P><FONT color="#666666" size="2" face="Arial, Helvetica, Verdana"><FONT color="#666666" size="1" face="Arial, Helvetica, Verdana"><FONT size="2" face="Arial, Helvetica, Verdana" color="#000000"><FONT color="#000000">Copyright © 2002-2003</FONT> <A href="http://www.jcorporate.com/" target="_blank">Jcorporate
-            Ltd</A>. All rights reserved.</FONT><FONT size="2" face="Arial, Helvetica, Verdana"><FONT color="#ffcc33"> <A href="http://www.jcorporate.com/html/aboutus/copyright.htm">Copyright</A> <A href="http://www.jcorporate.com/html/aboutus/privacy.htm">Privacy</A></FONT></FONT></FONT></FONT><FONT color="#666666" size="1" face="Arial, Helvetica, Verdana"><FONT color="#666666" size="1" face="Arial, Helvetica, Verdana"><FONT size="2" face="Arial, Helvetica, Verdana"><FONT color="#ffcc33"><A href="http://www.jcorporate.com/html/aboutus/privacy.htm"><BR>
-            </A></FONT></FONT><FONT face="Arial, Helvetica, Verdana" color="#666666" size="1"><BR>
-  Last Modified:
-  <!-- #BeginDate format:En2 -->11-Sep-2003<!-- #EndDate -->
-          </FONT></FONT></FONT></P>
-
-  <p>&nbsp;</p>
-</div>
-</body>
-</html>
\ No newline at end of file


More information about the cvs mailing list