jon         01/04/22 14:08:41

  Modified:    docs     user-guide.html
               docs/ymtd ymtd-changes.html ymtd-error-handling.html
                        ymtd-generation.html ymtd-hosting.html
                        ymtd-implementation.html ymtd-javabeans.html
                        ymtd-sampleapp.html ymtd-saying-hello.html
                        ymtd-taglibs.html ymtd.html
               xdocs/ymtd ymtd-changes.xml ymtd-error-handling.xml
                        ymtd-generation.xml ymtd-hosting.xml
                        ymtd-implementation.xml ymtd-javabeans.xml
                        ymtd-sampleapp.xml ymtd-saying-hello.xml
                        ymtd-taglibs.xml ymtd.xml
  Log:
  checked in changes to the user-guide.html
  
  various changes to the ymtd document based on people's feedback. see the
  ymtd-changes.html for more details or read the diff's.
  
  Revision  Changes    Path
  1.35      +12 -6     jakarta-velocity/docs/user-guide.html
  
  Index: user-guide.html
  ===================================================================
  RCS file: /home/cvs/jakarta-velocity/docs/user-guide.html,v
  retrieving revision 1.34
  retrieving revision 1.35
  diff -u -r1.34 -r1.35
  --- user-guide.html   2001/03/28 04:05:08     1.34
  +++ user-guide.html   2001/04/22 21:08:39     1.35
  @@ -1377,7 +1377,7 @@
           <li>Property reference</li>
           <li>Method reference</li>
           <li>Number literal</li>
  -        <li>Object array</li>
  +        <li>ArrayList</li>
       </ul>
    </p>
                                                   <p>
  @@ -1393,12 +1393,12 @@
       <tr>
         <td bgcolor="#023264" width="1"><img src="/images/void.gif" width="1" 
height="1" vspace="0" hspace="0" border="0"/></td>
         <td bgcolor="#ffffff"><pre>
  -#set( $monkey = $bill ) ##variable reference
  -#set( $monkey.Friend = &quot;monica&quot; ) ##string literal
  -#set( $monkey.Blame = $whitehouse.Leak ) ##property reference
  -#set( $monkey.Plan = $spindoctor.weave($web) ) ##method reference
  +#set( $monkey = $bill ) ## variable reference
  +#set( $monkey.Friend = &quot;monica&quot; ) ## string literal
  +#set( $monkey.Blame = $whitehouse.Leak ) ## property reference
  +#set( $monkey.Plan = $spindoctor.weave($web) ) ## method reference
   #set( $monkey.Number = 123 ) ##number literal
  -#set( $monkey.Say = [&quot;Not&quot;, $my, &quot;fault&quot;] ) ##object array
  +#set( $monkey.Say = [&quot;Not&quot;, $my, &quot;fault&quot;] ) ## ArrayList
   </pre></td>
         <td bgcolor="#023264" width="1"><img src="/images/void.gif" width="1" 
height="1" vspace="0" hspace="0" border="0"/></td>
       </tr>
  @@ -1409,6 +1409,12 @@
       </tr>
       </table>
       </div>
  +                                                <p>
  +   NOTE: In the last example the elements defined with the
  +   [..] operator are accessible using the methods defined
  +   in the ArrayList class. So, for example, you could access
  +   the first element above using $monkey.Say.get(0).
  + </p>
                                                   <p>
       The RHS can also be a simple arithmetic expression:
    </p>
  
  
  
  1.11      +8 -0      jakarta-velocity/docs/ymtd/ymtd-changes.html
  
  Index: ymtd-changes.html
  ===================================================================
  RCS file: /home/cvs/jakarta-velocity/docs/ymtd/ymtd-changes.html,v
  retrieving revision 1.10
  retrieving revision 1.11
  diff -u -r1.10 -r1.11
  --- ymtd-changes.html 2001/03/27 00:39:21     1.10
  +++ ymtd-changes.html 2001/04/22 21:08:39     1.11
  @@ -116,6 +116,14 @@
   </p>
                                                   <p>
   <ul>
  +<li>Rebuilt the helloworld.jsp example using Tomcat 3.3m2</li>
  +<li>Added Struts HelloWorld example from: <a 
href="mailto:[EMAIL PROTECTED]">Martin Cooper</a></li>
  +<li>Integrated feedback from <a href="mailto:[EMAIL PROTECTED]">Geir
  +Magnusson Jr.</a></li>
  +<li>Integrated feedback from <a href="mailto:[EMAIL PROTECTED]">dIon
  +Gillard</a></li>
  +<li>Typo fixes from <a href="mailto:[EMAIL PROTECTED]">Tim
  +Pizey</a></li>
   <li>Cleanup of the way that the <a 
href="./ymtd-implementation.html">Implementation</a> page 
   is written in order to clarify the points.</li>
   <li>Minor clarification in the <a href="./ymtd-saying-hello.html">Saying Hello</a> 
example.</li>
  
  
  
  1.10      +31 -19    jakarta-velocity/docs/ymtd/ymtd-error-handling.html
  
  Index: ymtd-error-handling.html
  ===================================================================
  RCS file: /home/cvs/jakarta-velocity/docs/ymtd/ymtd-error-handling.html,v
  retrieving revision 1.9
  retrieving revision 1.10
  diff -u -r1.9 -r1.10
  --- ymtd-error-handling.html  2001/03/27 00:39:21     1.9
  +++ ymtd-error-handling.html  2001/04/22 21:08:39     1.10
  @@ -189,9 +189,10 @@
       </table>
       </div>
                                                   <p>
  -JSP also allows one to define an error page that is used if an Throwable 
  -exception is thrown during the processing of a page. Doesn't this 
  -again break the MVC model?
  +JSP also allows one to define an error page that is used if an Throwable
  +exception is thrown during the processing of a page. Doesn't this again
  +break the MVC model? In other words, shouldn't the application framework
  +be responsible for dealing with error messages
   </p>
                                                       <div align="left">
       <table cellspacing="4" cellpadding="0" border="0">
  @@ -321,13 +322,16 @@
                                                   <p>
   Velocity does not have of these same problems because it does not allow
   the author to place any Java code within a template. The only things allowed
  -in the template are Velocity Template Language (VTL). Everything else is
  -ignored by the parser. The only place where one could run into trouble
  -within Velocity is if there is a call to a method which throws an
  -exception during runtime. For example, this VTL defines a String
  -<code>$foo</code> and then attempts to call its <code>substring()</code>
  -method on it would throw an <code>IndexOutOfBoundsException</code>:
  +in the template are Velocity Template Language (VTL) and method calls.
   </p>
  +                                                <p>
  +Everything else is considered 'text' for literal output by the parser.
  +The only place where one could run into trouble within Velocity is if
  +there is a call to a method which throws an exception during runtime.
  +For example, this VTL defines a String <code>$foo</code> and then
  +attempts to call its <code>substring()</code> method on it would throw
  +an <code>IndexOutOfBoundsException</code>:
  +</p>
                                                       <div align="left">
       <table cellspacing="4" cellpadding="0" border="0">
       <tr>
  @@ -355,16 +359,24 @@
   When the exception is thrown, the parser will stop processing and throw
   that exception up the stack tree where it can be caught in the method
   that caused the parser to execute. At that point, the exception can be
  -handled gracefully. This is one of the benefits of using Turbine
  -combined with Velocity because of Turbine's design it easy to deal with
  -Exceptions in a consistent manner. It is also possible to get this same
  -functionality with by using Velocity's included VelocityServlet. The
  -Exception will contain the line number and column number in the .vm file
  -of where the error happened. Because there is no abstraction like with
  -JSP, the line number and column matches up to the error. Also, the only
  -tool that will throw the exception is the parser. No need to try to
  -debug the cryptic javac messages which are a result of generated .java
  -code.
  +handled gracefully. Yes, this is something that is probably not easily
  +debugged by a Designer without Java knowledge, it is easily debugged by
  +a Template Engineer who has at least limited Java knowledge.
  +</p>
  +                                                <p>
  +This is one of the benefits of using Turbine combined with Velocity
  +because of Turbine's design it easy to deal with Exceptions in a
  +consistent manner. It is also possible to get this same functionality
  +with by using Velocity's included VelocityServlet. The Exception will
  +contain the line number and column number in the .vm file of where the
  +error happened. Because there is no abstraction like with JSP, the line
  +number and column matches up to the error. Also, the only tool that will
  +throw the exception is the parser and that exception will contain the
  +location and error information pertinent to your actual template, not an
  +intermediary file. No need to try to debug the cryptic javac messages
  +which are a result of generated .java code. Note: one commercial
  +application server offers better handling of matching the line number in
  +the JSP file to the error.
   </p>
                                                   <p>
   You make the decision.
  
  
  
  1.10      +44 -55    jakarta-velocity/docs/ymtd/ymtd-generation.html
  
  Index: ymtd-generation.html
  ===================================================================
  RCS file: /home/cvs/jakarta-velocity/docs/ymtd/ymtd-generation.html,v
  retrieving revision 1.9
  retrieving revision 1.10
  diff -u -r1.9 -r1.10
  --- ymtd-generation.html      2001/03/27 00:39:21     1.9
  +++ ymtd-generation.html      2001/04/22 21:08:39     1.10
  @@ -143,10 +143,11 @@
   templates, parse them a single time and then store an Abstract Syntax
   Tree (AST) representation of the template in memory which can then be
   re-used over and over again. The process is simply edit-&gt;parse-&gt;run. The
  -benefit is that Velocity ends up being much faster and it also removes
  -the requirement of having a javac compiler and temporary scratch
  -directory hanging around. In Velocity, when the template changes, the
  -existing cached template is simply replaced with a freshly parsed version.
  +benefit is that working with Velocity templates ends up being much
  +faster and it also removes the requirement of having a javac compiler
  +and temporary scratch directory hanging around. In Velocity, when the
  +template changes, the existing cached template is simply replaced with a
  +freshly parsed version.
   </p>
                                                   <p>
   Another advantage to Velocity's approach for templates is that the
  @@ -155,11 +156,6 @@
   create template loaders that can do anything that you want.
   </p>
                                                   <p>
  -A .jsp page is really nothing more than a Servlet. By default, there is
  -not a single shred of innovation there with regards to things like error
  -handling or overall Model 2 architecture.
  -</p>
  -                                                <p>
   Even without Turbine, Velocity offers several ways to deal with errors.
   Where frameworks such as Struts and Turbine come handy is by providing
   ways of properly dealing with errors. However, due to the fact that
  @@ -168,19 +164,13 @@
   on that.
   </p>
                                                   <p>
  -A major problem with the generated code is that it does not check to
  -make sure that the output stream is still open before attempting to
  -write to it. It also has the issue that if the stream is closed or an
  -IOException is thrown while attempting to output to the stream, there is
  -no way to catch it without using a specially defined error handler.
  -</p>
  -                                                <p>
   One final problem in the design shown below is that the JSP page only
  -catches <code>Exception</code>'s. What if the JSP page throws another
  -exception like <code>OutOfMemoryError</code>? The problem here is that
  -OOME is based on <code>Throwable</code>, not <code>Exception</code>.
  -Therefore, it is much more difficult to catch this exception with just a
  -JSP page.
  +catches <code>Exception</code>'s. What if the code within a JSP page
  +throws another exception like <code>OutOfMemoryError</code>? The problem
  +here is that OOME is based on <code>Throwable</code>, not
  +<code>Exception</code>. Therefore, it is much more difficult to catch
  +this exception with just a JSP page. Future versions of the JSP spec and
  +implementations will improve on this.
   </p>
                                                   <p>
   This nice <a href="./images/jsp-nasa-crash.gif" target="newWindow">example</a> 
provided by our friends at NASA, which
  @@ -228,6 +218,9 @@
   stream to the parser. Again, if there is an error, then another stream
   can be easily substituted for the output.
   </p>
  +                                                <p>
  +Here is an example of the intermediate code generated by Tomcat 3.3m2:
  +</p>
                                                       <div align="left">
       <table cellspacing="4" cellpadding="0" border="0">
       <tr>
  @@ -238,26 +231,27 @@
       <tr>
         <td bgcolor="#023264" width="1"><img src="/images/void.gif" width="1" 
height="1" vspace="0" hspace="0" border="0"/></td>
         <td bgcolor="#ffffff"><pre>
  +package jsp;
  +
   import javax.servlet.*;
   import javax.servlet.http.*;
   import javax.servlet.jsp.*;
   import javax.servlet.jsp.tagext.*;
  -import java.beans.*;
  -import java.io.*;
  -import java.util.*;
  -import org.apache.jasper.runtime.*;
  -import org.apache.jasper.*;
   
  -public class _0002fhello_00031_0002ejsphello1_jsp_0 extends HttpJspBase {
  -    private static boolean _jspx_inited = false;
  +public class helloworld_1 extends org.apache.jasper.runtime.HttpJspBase {
  +
  +    static {
  +    }
  +    public helloworld_1( ) {
  +    }
   
  -    public _0002fhello_00031_0002ejsphello1_jsp_0() { }
  +    private static boolean _jspx_inited = false;
   
  -    public final void _jspx_init() throws JasperException { }
  +    public final void _jspx_init() throws org.apache.jasper.JasperException {
  +    }
   
  -    public void _jspService(HttpServletRequest request, 
  -                            HttpServletResponse response)
  -                                throws IOException, ServletException {
  +    public void _jspService(HttpServletRequest request, HttpServletResponse  
response)
  +        throws java.io.IOException, ServletException {
   
           JspFactory _jspxFactory = null;
           PageContext pageContext = null;
  @@ -268,6 +262,7 @@
           Object page = this;
           String  _value = null;
           try {
  +
               if (_jspx_inited == false) {
                   _jspx_init();
                   _jspx_inited = true;
  @@ -275,40 +270,34 @@
               _jspxFactory = JspFactory.getDefaultFactory();
               response.setContentType(&quot;text/html;charset=8859_1&quot;);
               pageContext = _jspxFactory.getPageContext(this, request, response,
  -                        &quot;&quot;, true, 8192, true);
  +                     &quot;&quot;, true, 8192, true);
   
               application = pageContext.getServletContext();
               config = pageContext.getServletConfig();
               session = pageContext.getSession();
               out = pageContext.getOut();
   
  -            // HTML // begin [file=&quot;C:\\hello1.jsp&quot;;from=(0,0);to=(4,0)]
  -            
out.write(&quot;&lt;HTML&gt;\r\n&lt;HEAD&gt;&lt;TITLE&gt;Hello&lt;/TITLE&gt;&lt;/HEAD&gt;\r\n&lt;BODY&gt;&quot;);
  -            out.write(&quot;\r\n&lt;H1&gt;\r\n&quot;);
  -            // end
  -
  -            // begin [file=&quot;C:\\hello1.jsp&quot;;from=(4,2);to=(11,0)]
  -            if (request.getParameter(&quot;name&quot;) == null) {
  -               out.println(&quot;Hello World&quot;);
  -            }
  -            else {
  -              out.println(&quot;Hello, &quot; + 
request.getParameter(&quot;name&quot;));
  -            }
  -            // end
  +            
out.write(&quot;&lt;html&gt;\r\n&lt;head&gt;&lt;title&gt;Hello&lt;/title&gt;&lt;/head&gt;\r\n&lt;body&gt;\r\n&lt;h1&gt;\r\n&quot;);
  +            if (request.getParameter(&quot;name&quot;) == null) 
  +              out.write(&quot;\r\n          Hello World\r\n&quot;);
  +            else 
  +              out.write(&quot;\r\n          Hello, &quot;);
  +            request.getParameter(&quot;name&quot;); 
  +              
out.write(&quot;\r\n&lt;/h1&gt;\r\n&lt;/body&gt;&lt;/html&gt;\r\n&quot;);
   
  -            // HTML // begin [file=&quot;C:\\hello1.jsp&quot;;from=(11,2);to=(15,0)]
  -            
out.write(&quot;\r\n&lt;/H1&gt;\r\n&lt;/BODY&gt;&lt;/HTML&gt;\r\n\r\n&quot;);
  -            // end
           } catch (Exception ex) {
  -            if (out.getBufferSize() != 0)
  +            if (out != null &amp;&amp; out.getBufferSize() != 0)
                   out.clearBuffer();
  -            pageContext.handlePageException(ex);
  +            if (pageContext != null) pageContext.handlePageException(ex);
           } finally {
  -            out.flush();
  -            _jspxFactory.releasePageContext(pageContext);
  +            if (out instanceof org.apache.jasper.runtime.JspWriterImpl) { 
  +                ((org.apache.jasper.runtime.JspWriterImpl)out).flushBuffer();
  +            }
  +            if (_jspxFactory != null) _jspxFactory.releasePageContext(pageContext);
           }
       }
  -}</pre></td>
  +}
  +</pre></td>
         <td bgcolor="#023264" width="1"><img src="/images/void.gif" width="1" 
height="1" vspace="0" hspace="0" border="0"/></td>
       </tr>
       <tr>
  
  
  
  1.9       +11 -9     jakarta-velocity/docs/ymtd/ymtd-hosting.html
  
  Index: ymtd-hosting.html
  ===================================================================
  RCS file: /home/cvs/jakarta-velocity/docs/ymtd/ymtd-hosting.html,v
  retrieving revision 1.8
  retrieving revision 1.9
  diff -u -r1.8 -r1.9
  --- ymtd-hosting.html 2001/03/27 00:39:21     1.8
  +++ ymtd-hosting.html 2001/04/22 21:08:39     1.9
  @@ -111,9 +111,9 @@
                                       <p>
   JSP is great for hosted environments (ie: shared development
   environments, ISP's and large companies) where many different kinds of
  -people putting pages on the server may not know much more than
  -HTML. Part of the reason it is so nice is that with the HTML'ish syntax
  -JSP is so easy to learn!
  +people are putting pages on the servlet engine may not know much more
  +than HTML. Part of the reason it is so nice is that with the HTML'ish
  +syntax JSP is so easy to learn!
   </p>
                                                   <p>
   However, if one really looks at that statement in more detail it becomes
  @@ -157,21 +157,23 @@
   As soon as all of the memory is gone, every single hosted application
   will start to receive the dreaded "OutOfMemoryError". The reason why
   this is so bad has already been explained <a 
href="./ymtd-error-handling.html">earlier</a>. Essentially JSP pages
  -themselves cannot catch OOME errors and the entire server will suddenly
  -become useless, all because of what amounts to a few lines of badly
  -written Java code.
  +themselves cannot catch OOME errors and the entire servlet engine will
  +suddenly become useless, all because of what amounts to a few lines of
  +badly written Java code.
   </p>
                                                   <p>
   Remember, it is a bad idea to put Java code into a JSP page. Tell that
  -to the 14 year old kid who is being hosted on your ISP's server who
  -really does not care that others might be affected by these actions.
  +to the 14 year old kid who is being hosted on your ISP's servlet engine
  +who really does not care that others might be affected by these actions.
   </p>
                                                   <p>
   Velocity does not have this issue because there is no while loop in the
   Velocity Template Language. The only looping construct in Velocity is a
   #foreach and that loops over an array that has a finite amount of
   elements. It is also possible to disable the #foreach directive and
  -limit the amount of recursive nesting that is possible.
  +limit the amount of recursive nesting that is possible. Note: it is
  +possible to modify Velocity to add a #while directive to the template
  +language.
   </p>
                                                   <p>
   There is nothing in JSP or Struts that prevents people from embedding
  
  
  
  1.12      +13 -13    jakarta-velocity/docs/ymtd/ymtd-implementation.html
  
  Index: ymtd-implementation.html
  ===================================================================
  RCS file: /home/cvs/jakarta-velocity/docs/ymtd/ymtd-implementation.html,v
  retrieving revision 1.11
  retrieving revision 1.12
  diff -u -r1.11 -r1.12
  --- ymtd-implementation.html  2001/03/27 00:39:21     1.11
  +++ ymtd-implementation.html  2001/04/22 21:08:39     1.12
  @@ -170,7 +170,10 @@
   be determined by the implementation. Not only does this mean that there
   is plenty of places to make mistakes, but it also means that JSP
   template code has the possibility of not behaving the same across
  -implementations. This makes testing JSP based applications a nightmare.
  +implementations. This makes testing JSP based applications across
  +several different containers a nightmare. Especially if there are
  +essoteric bugs (meaning bugs that only show up under extreme conditions)
  +in one and not in the other.
   </p>
                                                   <p>
   Part of the founding reason for creating the Jakarta Project and having
  @@ -193,18 +196,15 @@
         <tr><td>
           <blockquote>
                                       <p>
  -Even though Velocity is lacking a formal specification document (it is
  -on the TODO list and volunteers are welcome to help out) and is not a
  -"Sun Specification Standard", that should not stop anyone from using it
  -in production environments. The reason is that, as shown above, is that
  -JSP is no more of a "standard" than anything else.
  -</p>
  -                                                <p>
  -Velocity is actually a more reliable implementation than JSP because
  -there is currently only one implementation. Even if there were more
  -implementations the modifications to all aspects of the Velocity project
  -are discussed in the open (anyone is welcome to participate) and the
  -testing suite is strictly maintained.
  +The definition of what Velocity is is set forth by the developers on the
  +project. They have created a comprehensive testing suite that is used
  +for regression testing to ensure that all changes to Velocity will not
  +break existing templates. If you or your company ever wants to join the
  +development of Velocity and help determine its direction that can be
  +done easily by simply joining a mailing list and contributing to the
  +development effort. This means that no one corporation will ever own the
  +Velocity specification and it also means that Velocity will always work
  +with your templates within any servlet engine.
   </p>
                               </blockquote>
         </td></tr>
  
  
  
  1.11      +4 -4      jakarta-velocity/docs/ymtd/ymtd-javabeans.html
  
  Index: ymtd-javabeans.html
  ===================================================================
  RCS file: /home/cvs/jakarta-velocity/docs/ymtd/ymtd-javabeans.html,v
  retrieving revision 1.10
  retrieving revision 1.11
  diff -u -r1.10 -r1.11
  --- ymtd-javabeans.html       2001/03/27 00:39:21     1.10
  +++ ymtd-javabeans.html       2001/04/22 21:08:39     1.11
  @@ -141,10 +141,10 @@
   right away is the use of the scope attribute. How many HTML designers
   understand the programming concepts of scope? It is safe to suggest that
   a good portion of web designers barely understand the concept of how a
  -CGI works. By stating this, we are not trying to slight people. Instead
  -we are simply pointing out that having a degree in Design does not also
  -imply that they also have a degree in Software Engineering or even web
  -applications.
  +CGI works. By stating this, we are not trying to slight people. Instead,
  +we are simply pointing out that design and software engineering are
  +distinct skill sets. You wouldn't expect a Java programmer to select a
  +print and web safe color palette, would you?
   </p>
                                                   <p>
   The common response to an argument like this is that the designers
  
  
  
  1.12      +1 -1      jakarta-velocity/docs/ymtd/ymtd-sampleapp.html
  
  Index: ymtd-sampleapp.html
  ===================================================================
  RCS file: /home/cvs/jakarta-velocity/docs/ymtd/ymtd-sampleapp.html,v
  retrieving revision 1.11
  retrieving revision 1.12
  diff -u -r1.11 -r1.12
  --- ymtd-sampleapp.html       2001/03/27 00:39:21     1.11
  +++ ymtd-sampleapp.html       2001/04/22 21:08:39     1.12
  @@ -239,7 +239,7 @@
       </div>
                                                   <hr noshade="true" size="1" />
                                                   <p>
  -On to the Velocity version...
  +This is the version of the example above translated to Velocity:
   </p>
                                                       <div align="left">
       <table cellspacing="4" cellpadding="0" border="0">
  
  
  
  1.12      +46 -7     jakarta-velocity/docs/ymtd/ymtd-saying-hello.html
  
  Index: ymtd-saying-hello.html
  ===================================================================
  RCS file: /home/cvs/jakarta-velocity/docs/ymtd/ymtd-saying-hello.html,v
  retrieving revision 1.11
  retrieving revision 1.12
  diff -u -r1.11 -r1.12
  --- ymtd-saying-hello.html    2001/03/27 00:39:22     1.11
  +++ ymtd-saying-hello.html    2001/04/22 21:08:39     1.12
  @@ -199,7 +199,9 @@
                                                   <p>
   The primary difference between the two is the way that output is
   performed. With JSP, one needs to embed "code" within <code>&lt;%
  -%&gt;</code> tags and for Velocity, one does not need to do that.
  +%&gt;</code> tags and for Velocity, one does not need to embed "code"
  +within tags. One can simply use the Velocity Template Language (VTL)
  +directly in any portion of the template.
   </p>
                                                   <p>
   The benefit (and detriment) of the embedded code is that the JSP code
  @@ -239,7 +241,7 @@
   &lt;% if (request.getParameter(&quot;name&quot;) == null) %&gt;
             Hello World
   &lt;% else %&gt;
  -          Hello, &lt;% request.getParameter(&quot;name&quot;) %&gt;
  +          Hello, &lt;% request.getParameter(&quot;name&quot;); %&gt;
   &lt;/h1&gt;
   &lt;/body&gt;&lt;/html&gt;</pre></td>
         <td bgcolor="#023264" width="1"><img src="/images/void.gif" width="1" 
height="1" vspace="0" hspace="0" border="0"/></td>
  @@ -251,6 +253,42 @@
       </tr>
       </table>
       </div>
  +                                                <p>
  +Or with Struts:
  +</p>
  +                                                    <div align="left">
  +    <table cellspacing="4" cellpadding="0" border="0">
  +    <tr>
  +      <td bgcolor="#023264" width="1" height="1"><img src="/images/void.gif" 
width="1" height="1" vspace="0" hspace="0" border="0"/></td>
  +      <td bgcolor="#023264" height="1"><img src="/images/void.gif" width="1" 
height="1" vspace="0" hspace="0" border="0"/></td>
  +      <td bgcolor="#023264" width="1" height="1"><img src="/images/void.gif" 
width="1" height="1" vspace="0" hspace="0" border="0"/></td>
  +    </tr>
  +    <tr>
  +      <td bgcolor="#023264" width="1"><img src="/images/void.gif" width="1" 
height="1" vspace="0" hspace="0" border="0"/></td>
  +      <td bgcolor="#ffffff"><pre>
  +&lt;html&gt;
  +&lt;head&gt;&lt;title&gt;Hello&lt;/title&gt;&lt;/head&gt;
  +&lt;body&gt;
  +&lt;h1&gt;
  +&lt;logic:notPresent parameter=&quot;name&quot;&gt;
  +          Hello World
  +&lt;/logic:notPresent&gt;
  +&lt;logic:present parameter=&quot;name&quot;&gt;
  +          &lt;bean:parameter id=&quot;name&quot; name=&quot;name&quot;/&gt;
  +          Hello, &lt;bean:write name=&quot;name&quot;/&gt;
  +&lt;/logic:present&gt;
  +&lt;/h1&gt;
  +&lt;/body&gt;&lt;/html&gt;
  +</pre></td>
  +      <td bgcolor="#023264" width="1"><img src="/images/void.gif" width="1" 
height="1" vspace="0" hspace="0" border="0"/></td>
  +    </tr>
  +    <tr>
  +      <td bgcolor="#023264" width="1" height="1"><img src="/images/void.gif" 
width="1" height="1" vspace="0" hspace="0" border="0"/></td>
  +      <td bgcolor="#023264" height="1"><img src="/images/void.gif" width="1" 
height="1" vspace="0" hspace="0" border="0"/></td>
  +      <td bgcolor="#023264" width="1" height="1"><img src="/images/void.gif" 
width="1" height="1" vspace="0" hspace="0" border="0"/></td>
  +    </tr>
  +    </table>
  +    </div>
                                                   <ul>
   <li><a href="./images/hello-jsp2.gif" target="newWindow">Hello JSP Screen 
shot</a></li>
   </ul>
  @@ -265,15 +303,16 @@
   to the Velocity example. However, one still needs to embed the necessary
   <code>&lt;% %&gt;</code> tags everywhere. More typing == more chances
   for mistakes! There is also a bit of a disconnect as to when the ";"
  -needs to be added and when it does not.
  +needs to be added and when it does not. With Velocity, the rule is that
  +you place a # before a directive and a $ before a member in the Context.
   </p>
                                                   <p>
   As you can see from the example image, there is now a bit more
   information in the displayed page, except that it is also missing all of
  -the logic which was used to build the page. In this simple example, it
  -is not very clear why this is beneficial. However, in more complex
  -examples (like with a <code>for/foreach</code> loop) it becomes much
  -more clear why it can be advantageous to see the logic in the page.
  +the logic which was used to build the page. If one views the equivalent
  +Velocity template directly in the browser, without it being rendered
  +first, all of the logic in the template remains visible. The advantage
  +is that it is easier to debug problems.
   </p>
                                                   <p>
   You make the decision.
  
  
  
  1.11      +36 -4     jakarta-velocity/docs/ymtd/ymtd-taglibs.html
  
  Index: ymtd-taglibs.html
  ===================================================================
  RCS file: /home/cvs/jakarta-velocity/docs/ymtd/ymtd-taglibs.html,v
  retrieving revision 1.10
  retrieving revision 1.11
  diff -u -r1.10 -r1.11
  --- ymtd-taglibs.html 2001/03/27 00:39:22     1.10
  +++ ymtd-taglibs.html 2001/04/22 21:08:40     1.11
  @@ -208,6 +208,36 @@
       </table>
       </div>
                                                   <p>
  +Of course this could be written even cleaner as:
  +</p>
  +                                                    <div align="left">
  +    <table cellspacing="4" cellpadding="0" border="0">
  +    <tr>
  +      <td bgcolor="#023264" width="1" height="1"><img src="/images/void.gif" 
width="1" height="1" vspace="0" hspace="0" border="0"/></td>
  +      <td bgcolor="#023264" height="1"><img src="/images/void.gif" width="1" 
height="1" vspace="0" hspace="0" border="0"/></td>
  +      <td bgcolor="#023264" width="1" height="1"><img src="/images/void.gif" 
width="1" height="1" vspace="0" hspace="0" border="0"/></td>
  +    </tr>
  +    <tr>
  +      <td bgcolor="#023264" width="1"><img src="/images/void.gif" width="1" 
height="1" vspace="0" hspace="0" border="0"/></td>
  +      <td bgcolor="#ffffff"><pre>
  +#if($number == 7)
  +  You guessed right! You win a high speed blender!
  +#elseif( $number &lt; 7 )
  +  lower
  +#else
  +  higher
  +#end
  +</pre></td>
  +      <td bgcolor="#023264" width="1"><img src="/images/void.gif" width="1" 
height="1" vspace="0" hspace="0" border="0"/></td>
  +    </tr>
  +    <tr>
  +      <td bgcolor="#023264" width="1" height="1"><img src="/images/void.gif" 
width="1" height="1" vspace="0" hspace="0" border="0"/></td>
  +      <td bgcolor="#023264" height="1"><img src="/images/void.gif" width="1" 
height="1" vspace="0" hspace="0" border="0"/></td>
  +      <td bgcolor="#023264" width="1" height="1"><img src="/images/void.gif" 
width="1" height="1" vspace="0" hspace="0" border="0"/></td>
  +    </tr>
  +    </table>
  +    </div>
  +                                                <p>
   This really falls into a preferences situation. In other words, which
   syntax would someone prefer to use? It seems as though the amount of
   typing required to implement the taglibs approach would be a major
  @@ -391,6 +421,8 @@
   #elseif
   #foreach
   #set
  +#parse
  +#include
   </pre></td>
         <td bgcolor="#023264" width="1"><img src="/images/void.gif" width="1" 
height="1" vspace="0" hspace="0" border="0"/></td>
       </tr>
  @@ -427,10 +459,10 @@
   </p>
                                                   <p>
   One last point to make about using a HTML syntax is that this really
  -pigeon holes JSP and Struts into simply being a tool for creating only
  -dynamic HTML code. Velocity on the other hand is designed to take as
  -input any type of text (Java, SQL, HTML, etc) and output anything as a
  -result of running it through its processing engine.
  +pigeon holes JSP and Struts into simply being a tool for creating
  +dynamic HTML/XML/WML (ie: tag markup) code. Velocity on the other hand
  +is designed to take as input any type of text (Java, SQL, HTML, etc) and
  +output anything as a result of running it through its processing engine.
   </p>
                                                   <p>
   You make the decision.
  
  
  
  1.11      +8 -9      jakarta-velocity/docs/ymtd/ymtd.html
  
  Index: ymtd.html
  ===================================================================
  RCS file: /home/cvs/jakarta-velocity/docs/ymtd/ymtd.html,v
  retrieving revision 1.10
  retrieving revision 1.11
  diff -u -r1.10 -r1.11
  --- ymtd.html 2001/03/27 00:39:22     1.10
  +++ ymtd.html 2001/04/22 21:08:40     1.11
  @@ -111,7 +111,7 @@
                                       <p>
   The title of this essay is called "You make the decision." The point of
   this essay is to explore what it is like to develop a web application
  -using a couple popular tools that are available today. In order to do
  +using a couple of popular tools that are available today. In order to do
   this, examples of using these technologies will be shown. This will give
   a nice first person account of what it is like to use these technologies
   on a daily basis.
  @@ -140,12 +140,11 @@
         <tr><td>
           <blockquote>
                                       <p>
  -This multi page document will compare usage of Turbine/Velocity and
  -Struts/JSP. In both cases, we have a framework of reusable code that
  -makes life easier for building web applications by providing the "Model"
  -and "Controller" portions of the MVC paradigm (Turbine and Struts).
  -There is also a template language that provides the "View" portion (JSP
  -and Velocity).
  +This multi page document will compare usage of Velocity and JSP. In both
  +cases, we have a framework of reusable code that makes life easier for
  +building web applications by providing the "Model" and "Controller"
  +portions of the MVC paradigm (Turbine and Struts). There is also a
  +template language that provides the "View" portion (JSP and Velocity).
   </p>
                                                   <p>
   Please note that there are a bazillion different things that could be
  @@ -181,7 +180,7 @@
           <blockquote>
                                       <p>
   We would first like to thank the entire <a href="../contributors.html">Velocity</a> 
and <a href="/turbine/contributors.html">Turbine</a> teams for creating such
  -kick ass products. These groups are a 100% volunteer organization and
  +great products. These groups are a 100% volunteer organization and
   some very talented engineers have come together from around the world to
   help make these products a reality and a success. They deserve a round
   of thanks and appreciation for their hard work and dedication.
  @@ -227,7 +226,7 @@
   </p>
                                                   <p>
   If there are any changes that need to be made to this document, please
  -do not hesitate to contact <a href="[EMAIL PROTECTED]">Jon Stevens</a>.
  +do not hesitate to contact <a href="mailto:[EMAIL PROTECTED]">Jon Stevens</a>.
   </p>
                                                   <p>
   On to the rest of the essay...
  
  
  
  1.4       +9 -0      jakarta-velocity/xdocs/ymtd/ymtd-changes.xml
  
  Index: ymtd-changes.xml
  ===================================================================
  RCS file: /home/cvs/jakarta-velocity/xdocs/ymtd/ymtd-changes.xml,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- ymtd-changes.xml  2001/03/05 01:56:39     1.3
  +++ ymtd-changes.xml  2001/04/22 21:08:40     1.4
  @@ -19,6 +19,15 @@
   
   <p>
   <ul>
  +<li>Rebuilt the helloworld.jsp example using Tomcat 3.3m2</li>
  +<li>Added Struts HelloWorld example from: <a
  +href="mailto:[EMAIL PROTECTED]">Martin Cooper</a></li>
  +<li>Integrated feedback from <a href="mailto:[EMAIL PROTECTED]">Geir
  +Magnusson Jr.</a></li>
  +<li>Integrated feedback from <a href="mailto:[EMAIL PROTECTED]">dIon
  +Gillard</a></li>
  +<li>Typo fixes from <a href="mailto:[EMAIL PROTECTED]">Tim
  +Pizey</a></li>
   <li>Cleanup of the way that the <a
   href="./ymtd-implementation.html">Implementation</a> page 
   is written in order to clarify the points.</li>
  
  
  
  1.2       +33 -19    jakarta-velocity/xdocs/ymtd/ymtd-error-handling.xml
  
  Index: ymtd-error-handling.xml
  ===================================================================
  RCS file: /home/cvs/jakarta-velocity/xdocs/ymtd/ymtd-error-handling.xml,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- ymtd-error-handling.xml   2001/03/03 08:23:51     1.1
  +++ ymtd-error-handling.xml   2001/04/22 21:08:40     1.2
  @@ -61,9 +61,10 @@
   ]]></source>
   
   <p>
  -JSP also allows one to define an error page that is used if an Throwable 
  -exception is thrown during the processing of a page. Doesn't this 
  -again break the MVC model?
  +JSP also allows one to define an error page that is used if an Throwable
  +exception is thrown during the processing of a page. Doesn't this again
  +break the MVC model? In other words, shouldn't the application framework
  +be responsible for dealing with error messages
   </p>
   
   <source><![CDATA[
  @@ -129,14 +130,18 @@
   <p>
   Velocity does not have of these same problems because it does not allow
   the author to place any Java code within a template. The only things allowed
  -in the template are Velocity Template Language (VTL). Everything else is
  -ignored by the parser. The only place where one could run into trouble
  -within Velocity is if there is a call to a method which throws an
  -exception during runtime. For example, this VTL defines a String
  -<code>$foo</code> and then attempts to call its <code>substring()</code>
  -method on it would throw an <code>IndexOutOfBoundsException</code>:
  +in the template are Velocity Template Language (VTL) and method calls.
   </p>
   
  +<p>
  +Everything else is considered 'text' for literal output by the parser.
  +The only place where one could run into trouble within Velocity is if
  +there is a call to a method which throws an exception during runtime.
  +For example, this VTL defines a String <code>$foo</code> and then
  +attempts to call its <code>substring()</code> method on it would throw
  +an <code>IndexOutOfBoundsException</code>:
  +</p>
  +
   <source><![CDATA[
   #set ($foo = "bar")
   
  @@ -147,16 +152,25 @@
   When the exception is thrown, the parser will stop processing and throw
   that exception up the stack tree where it can be caught in the method
   that caused the parser to execute. At that point, the exception can be
  -handled gracefully. This is one of the benefits of using Turbine
  -combined with Velocity because of Turbine's design it easy to deal with
  -Exceptions in a consistent manner. It is also possible to get this same
  -functionality with by using Velocity's included VelocityServlet. The
  -Exception will contain the line number and column number in the .vm file
  -of where the error happened. Because there is no abstraction like with
  -JSP, the line number and column matches up to the error. Also, the only
  -tool that will throw the exception is the parser. No need to try to
  -debug the cryptic javac messages which are a result of generated .java
  -code.
  +handled gracefully. Yes, this is something that is probably not easily
  +debugged by a Designer without Java knowledge, it is easily debugged by
  +a Template Engineer who has at least limited Java knowledge.
  +</p>
  +
  +<p>
  +This is one of the benefits of using Turbine combined with Velocity
  +because of Turbine's design it easy to deal with Exceptions in a
  +consistent manner. It is also possible to get this same functionality
  +with by using Velocity's included VelocityServlet. The Exception will
  +contain the line number and column number in the .vm file of where the
  +error happened. Because there is no abstraction like with JSP, the line
  +number and column matches up to the error. Also, the only tool that will
  +throw the exception is the parser and that exception will contain the
  +location and error information pertinent to your actual template, not an
  +intermediary file. No need to try to debug the cryptic javac messages
  +which are a result of generated .java code. Note: one commercial
  +application server offers better handling of matching the line number in
  +the JSP file to the error.
   </p>
   
   <p>
  
  
  
  1.2       +45 -57    jakarta-velocity/xdocs/ymtd/ymtd-generation.xml
  
  Index: ymtd-generation.xml
  ===================================================================
  RCS file: /home/cvs/jakarta-velocity/xdocs/ymtd/ymtd-generation.xml,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- ymtd-generation.xml       2001/03/03 08:23:51     1.1
  +++ ymtd-generation.xml       2001/04/22 21:08:40     1.2
  @@ -48,10 +48,11 @@
   templates, parse them a single time and then store an Abstract Syntax
   Tree (AST) representation of the template in memory which can then be
   re-used over and over again. The process is simply edit->parse->run. The
  -benefit is that Velocity ends up being much faster and it also removes
  -the requirement of having a javac compiler and temporary scratch
  -directory hanging around. In Velocity, when the template changes, the
  -existing cached template is simply replaced with a freshly parsed version.
  +benefit is that working with Velocity templates ends up being much
  +faster and it also removes the requirement of having a javac compiler
  +and temporary scratch directory hanging around. In Velocity, when the
  +template changes, the existing cached template is simply replaced with a
  +freshly parsed version.
   </p>
   
   <p>
  @@ -62,12 +63,6 @@
   </p>
   
   <p>
  -A .jsp page is really nothing more than a Servlet. By default, there is
  -not a single shred of innovation there with regards to things like error
  -handling or overall Model 2 architecture.
  -</p>
  -
  -<p>
   Even without Turbine, Velocity offers several ways to deal with errors.
   Where frameworks such as Struts and Turbine come handy is by providing
   ways of properly dealing with errors. However, due to the fact that
  @@ -77,20 +72,13 @@
   </p>
   
   <p>
  -A major problem with the generated code is that it does not check to
  -make sure that the output stream is still open before attempting to
  -write to it. It also has the issue that if the stream is closed or an
  -IOException is thrown while attempting to output to the stream, there is
  -no way to catch it without using a specially defined error handler.
  -</p>
  -
  -<p>
   One final problem in the design shown below is that the JSP page only
  -catches <code>Exception</code>'s. What if the JSP page throws another
  -exception like <code>OutOfMemoryError</code>? The problem here is that
  -OOME is based on <code>Throwable</code>, not <code>Exception</code>.
  -Therefore, it is much more difficult to catch this exception with just a
  -JSP page.
  +catches <code>Exception</code>'s. What if the code within a JSP page
  +throws another exception like <code>OutOfMemoryError</code>? The problem
  +here is that OOME is based on <code>Throwable</code>, not
  +<code>Exception</code>. Therefore, it is much more difficult to catch
  +this exception with just a JSP page. Future versions of the JSP spec and
  +implementations will improve on this.
   </p>
   
   <p>
  @@ -127,27 +115,32 @@
   can be easily substituted for the output.
   </p>
   
  +<p>
  +Here is an example of the intermediate code generated by Tomcat 3.3m2:
  +</p>
  +
   <source><![CDATA[
  +package jsp;
  +
   import javax.servlet.*;
   import javax.servlet.http.*;
   import javax.servlet.jsp.*;
   import javax.servlet.jsp.tagext.*;
  -import java.beans.*;
  -import java.io.*;
  -import java.util.*;
  -import org.apache.jasper.runtime.*;
  -import org.apache.jasper.*;
   
  -public class _0002fhello_00031_0002ejsphello1_jsp_0 extends HttpJspBase {
  -    private static boolean _jspx_inited = false;
  +public class helloworld_1 extends org.apache.jasper.runtime.HttpJspBase {
   
  -    public _0002fhello_00031_0002ejsphello1_jsp_0() { }
  +    static {
  +    }
  +    public helloworld_1( ) {
  +    }
   
  -    public final void _jspx_init() throws JasperException { }
  +    private static boolean _jspx_inited = false;
  +
  +    public final void _jspx_init() throws org.apache.jasper.JasperException {
  +    }
   
  -    public void _jspService(HttpServletRequest request, 
  -                            HttpServletResponse response)
  -                                throws IOException, ServletException {
  +    public void _jspService(HttpServletRequest request, HttpServletResponse  
response)
  +        throws java.io.IOException, ServletException {
   
           JspFactory _jspxFactory = null;
           PageContext pageContext = null;
  @@ -158,6 +151,7 @@
           Object page = this;
           String  _value = null;
           try {
  +
               if (_jspx_inited == false) {
                   _jspx_init();
                   _jspx_inited = true;
  @@ -165,40 +159,34 @@
               _jspxFactory = JspFactory.getDefaultFactory();
               response.setContentType("text/html;charset=8859_1");
               pageContext = _jspxFactory.getPageContext(this, request, response,
  -                        "", true, 8192, true);
  +                     "", true, 8192, true);
   
               application = pageContext.getServletContext();
               config = pageContext.getServletConfig();
               session = pageContext.getSession();
               out = pageContext.getOut();
   
  -            // HTML // begin [file="C:\\hello1.jsp";from=(0,0);to=(4,0)]
  -            out.write("<HTML>\r\n<HEAD><TITLE>Hello</TITLE></HEAD>\r\n<BODY>");
  -            out.write("\r\n<H1>\r\n");
  -            // end
  -
  -            // begin [file="C:\\hello1.jsp";from=(4,2);to=(11,0)]
  -            if (request.getParameter("name") == null) {
  -               out.println("Hello World");
  -            }
  -            else {
  -              out.println("Hello, " + request.getParameter("name"));
  -            }
  -            // end
  +            
out.write("<html>\r\n<head><title>Hello</title></head>\r\n<body>\r\n<h1>\r\n");
  +            if (request.getParameter("name") == null) 
  +              out.write("\r\n          Hello World\r\n");
  +            else 
  +              out.write("\r\n          Hello, ");
  +            request.getParameter("name"); 
  +              out.write("\r\n</h1>\r\n</body></html>\r\n");
   
  -            // HTML // begin [file="C:\\hello1.jsp";from=(11,2);to=(15,0)]
  -            out.write("\r\n</H1>\r\n</BODY></HTML>\r\n\r\n");
  -            // end
           } catch (Exception ex) {
  -            if (out.getBufferSize() != 0)
  +            if (out != null && out.getBufferSize() != 0)
                   out.clearBuffer();
  -            pageContext.handlePageException(ex);
  +            if (pageContext != null) pageContext.handlePageException(ex);
           } finally {
  -            out.flush();
  -            _jspxFactory.releasePageContext(pageContext);
  +            if (out instanceof org.apache.jasper.runtime.JspWriterImpl) { 
  +                ((org.apache.jasper.runtime.JspWriterImpl)out).flushBuffer();
  +            }
  +            if (_jspxFactory != null) _jspxFactory.releasePageContext(pageContext);
           }
       }
  -}]]></source>
  +}
  +]]></source>
   
   <p>
   You make the decision.
  
  
  
  1.2       +11 -9     jakarta-velocity/xdocs/ymtd/ymtd-hosting.xml
  
  Index: ymtd-hosting.xml
  ===================================================================
  RCS file: /home/cvs/jakarta-velocity/xdocs/ymtd/ymtd-hosting.xml,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- ymtd-hosting.xml  2001/03/04 23:16:08     1.1
  +++ ymtd-hosting.xml  2001/04/22 21:08:40     1.2
  @@ -13,9 +13,9 @@
   <p>
   JSP is great for hosted environments (ie: shared development
   environments, ISP's and large companies) where many different kinds of
  -people putting pages on the server may not know much more than
  -HTML. Part of the reason it is so nice is that with the HTML'ish syntax
  -JSP is so easy to learn!
  +people are putting pages on the servlet engine may not know much more
  +than HTML. Part of the reason it is so nice is that with the HTML'ish
  +syntax JSP is so easy to learn!
   </p>
   
   <p>
  @@ -46,15 +46,15 @@
   will start to receive the dreaded "OutOfMemoryError". The reason why
   this is so bad has already been explained <a
   href="./ymtd-error-handling.html">earlier</a>. Essentially JSP pages
  -themselves cannot catch OOME errors and the entire server will suddenly
  -become useless, all because of what amounts to a few lines of badly
  -written Java code.
  +themselves cannot catch OOME errors and the entire servlet engine will
  +suddenly become useless, all because of what amounts to a few lines of
  +badly written Java code.
   </p>
   
   <p>
   Remember, it is a bad idea to put Java code into a JSP page. Tell that
  -to the 14 year old kid who is being hosted on your ISP's server who
  -really does not care that others might be affected by these actions.
  +to the 14 year old kid who is being hosted on your ISP's servlet engine
  +who really does not care that others might be affected by these actions.
   </p>
   
   <p>
  @@ -62,7 +62,9 @@
   Velocity Template Language. The only looping construct in Velocity is a
   #foreach and that loops over an array that has a finite amount of
   elements. It is also possible to disable the #foreach directive and
  -limit the amount of recursive nesting that is possible.
  +limit the amount of recursive nesting that is possible. Note: it is
  +possible to modify Velocity to add a #while directive to the template
  +language.
   </p>
   
   <p>
  
  
  
  1.4       +13 -14    jakarta-velocity/xdocs/ymtd/ymtd-implementation.xml
  
  Index: ymtd-implementation.xml
  ===================================================================
  RCS file: /home/cvs/jakarta-velocity/xdocs/ymtd/ymtd-implementation.xml,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- ymtd-implementation.xml   2001/03/05 01:56:39     1.3
  +++ ymtd-implementation.xml   2001/04/22 21:08:40     1.4
  @@ -63,7 +63,10 @@
   be determined by the implementation. Not only does this mean that there
   is plenty of places to make mistakes, but it also means that JSP
   template code has the possibility of not behaving the same across
  -implementations. This makes testing JSP based applications a nightmare.
  +implementations. This makes testing JSP based applications across
  +several different containers a nightmare. Especially if there are
  +essoteric bugs (meaning bugs that only show up under extreme conditions)
  +in one and not in the other.
   </p>
   
   <p>
  @@ -81,19 +84,15 @@
   <subsection name="The final point: Velocity">
   
   <p>
  -Even though Velocity is lacking a formal specification document (it is
  -on the TODO list and volunteers are welcome to help out) and is not a
  -"Sun Specification Standard", that should not stop anyone from using it
  -in production environments. The reason is that, as shown above, is that
  -JSP is no more of a "standard" than anything else.
  -</p>
  -
  -<p>
  -Velocity is actually a more reliable implementation than JSP because
  -there is currently only one implementation. Even if there were more
  -implementations the modifications to all aspects of the Velocity project
  -are discussed in the open (anyone is welcome to participate) and the
  -testing suite is strictly maintained.
  +The definition of what Velocity is is set forth by the developers on the
  +project. They have created a comprehensive testing suite that is used
  +for regression testing to ensure that all changes to Velocity will not
  +break existing templates. If you or your company ever wants to join the
  +development of Velocity and help determine its direction that can be
  +done easily by simply joining a mailing list and contributing to the
  +development effort. This means that no one corporation will ever own the
  +Velocity specification and it also means that Velocity will always work
  +with your templates within any servlet engine.
   </p>
   
   </subsection>
  
  
  
  1.3       +4 -4      jakarta-velocity/xdocs/ymtd/ymtd-javabeans.xml
  
  Index: ymtd-javabeans.xml
  ===================================================================
  RCS file: /home/cvs/jakarta-velocity/xdocs/ymtd/ymtd-javabeans.xml,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- ymtd-javabeans.xml        2001/03/04 23:16:08     1.2
  +++ ymtd-javabeans.xml        2001/04/22 21:08:40     1.3
  @@ -28,10 +28,10 @@
   right away is the use of the scope attribute. How many HTML designers
   understand the programming concepts of scope? It is safe to suggest that
   a good portion of web designers barely understand the concept of how a
  -CGI works. By stating this, we are not trying to slight people. Instead
  -we are simply pointing out that having a degree in Design does not also
  -imply that they also have a degree in Software Engineering or even web
  -applications.
  +CGI works. By stating this, we are not trying to slight people. Instead,
  +we are simply pointing out that design and software engineering are
  +distinct skill sets. You wouldn't expect a Java programmer to select a
  +print and web safe color palette, would you?
   </p>
   
   <p>
  
  
  
  1.4       +1 -1      jakarta-velocity/xdocs/ymtd/ymtd-sampleapp.xml
  
  Index: ymtd-sampleapp.xml
  ===================================================================
  RCS file: /home/cvs/jakarta-velocity/xdocs/ymtd/ymtd-sampleapp.xml,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- ymtd-sampleapp.xml        2001/03/04 23:16:08     1.3
  +++ ymtd-sampleapp.xml        2001/04/22 21:08:40     1.4
  @@ -114,7 +114,7 @@
   <hr noshade="true" size="1"/>
   
   <p>
  -On to the Velocity version...
  +This is the version of the example above translated to Velocity:
   </p>
   
   <source><![CDATA[
  
  
  
  1.4       +30 -7     jakarta-velocity/xdocs/ymtd/ymtd-saying-hello.xml
  
  Index: ymtd-saying-hello.xml
  ===================================================================
  RCS file: /home/cvs/jakarta-velocity/xdocs/ymtd/ymtd-saying-hello.xml,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- ymtd-saying-hello.xml     2001/03/05 00:06:12     1.3
  +++ ymtd-saying-hello.xml     2001/04/22 21:08:40     1.4
  @@ -73,7 +73,9 @@
   <p>
   The primary difference between the two is the way that output is
   performed. With JSP, one needs to embed "code" within <code>&lt;%
  -%&gt;</code> tags and for Velocity, one does not need to do that.
  +%&gt;</code> tags and for Velocity, one does not need to embed "code"
  +within tags. One can simply use the Velocity Template Language (VTL)
  +directly in any portion of the template.
   </p>
   
   <p>
  @@ -108,10 +110,30 @@
   <% if (request.getParameter("name") == null) %>
             Hello World
   <% else %>
  -          Hello, <% request.getParameter("name") %>
  +          Hello, <% request.getParameter("name"); %>
   </h1>
   </body></html>]]></source>
   
  +<p>
  +Or with Struts:
  +</p>
  +
  +<source><![CDATA[
  +<html>
  +<head><title>Hello</title></head>
  +<body>
  +<h1>
  +<logic:notPresent parameter="name">
  +          Hello World
  +</logic:notPresent>
  +<logic:present parameter="name">
  +          <bean:parameter id="name" name="name"/>
  +          Hello, <bean:write name="name"/>
  +</logic:present>
  +</h1>
  +</body></html>
  +]]></source>
  +
   <ul>
   <li><a href="./images/hello-jsp2.gif" target="newWindow">Hello JSP Screen 
shot</a></li>
   </ul>
  @@ -129,16 +151,17 @@
   to the Velocity example. However, one still needs to embed the necessary
   <code>&lt;% %&gt;</code> tags everywhere. More typing == more chances
   for mistakes! There is also a bit of a disconnect as to when the ";"
  -needs to be added and when it does not.
  +needs to be added and when it does not. With Velocity, the rule is that
  +you place a # before a directive and a $ before a member in the Context.
   </p>
   
   <p>
   As you can see from the example image, there is now a bit more
   information in the displayed page, except that it is also missing all of
  -the logic which was used to build the page. In this simple example, it
  -is not very clear why this is beneficial. However, in more complex
  -examples (like with a <code>for/foreach</code> loop) it becomes much
  -more clear why it can be advantageous to see the logic in the page.
  +the logic which was used to build the page. If one views the equivalent
  +Velocity template directly in the browser, without it being rendered
  +first, all of the logic in the template remains visible. The advantage
  +is that it is easier to debug problems.
   </p>
   
   <p>
  
  
  
  1.3       +20 -4     jakarta-velocity/xdocs/ymtd/ymtd-taglibs.xml
  
  Index: ymtd-taglibs.xml
  ===================================================================
  RCS file: /home/cvs/jakarta-velocity/xdocs/ymtd/ymtd-taglibs.xml,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- ymtd-taglibs.xml  2001/03/04 23:16:09     1.2
  +++ ymtd-taglibs.xml  2001/04/22 21:08:40     1.3
  @@ -79,6 +79,20 @@
   ]]></source>
   
   <p>
  +Of course this could be written even cleaner as:
  +</p>
  +
  +<source><![CDATA[
  +#if($number == 7)
  +  You guessed right! You win a high speed blender!
  +#elseif( $number < 7 )
  +  lower
  +#else
  +  higher
  +#end
  +]]></source>
  +
  +<p>
   This really falls into a preferences situation. In other words, which
   syntax would someone prefer to use? It seems as though the amount of
   typing required to implement the taglibs approach would be a major
  @@ -210,6 +224,8 @@
   #elseif
   #foreach
   #set
  +#parse
  +#include
   </source>
   
   <p>
  @@ -241,10 +257,10 @@
   
   <p>
   One last point to make about using a HTML syntax is that this really
  -pigeon holes JSP and Struts into simply being a tool for creating only
  -dynamic HTML code. Velocity on the other hand is designed to take as
  -input any type of text (Java, SQL, HTML, etc) and output anything as a
  -result of running it through its processing engine.
  +pigeon holes JSP and Struts into simply being a tool for creating
  +dynamic HTML/XML/WML (ie: tag markup) code. Velocity on the other hand
  +is designed to take as input any type of text (Java, SQL, HTML, etc) and
  +output anything as a result of running it through its processing engine.
   </p>
   
   <p>
  
  
  
  1.4       +6 -7      jakarta-velocity/xdocs/ymtd/ymtd.xml
  
  Index: ymtd.xml
  ===================================================================
  RCS file: /home/cvs/jakarta-velocity/xdocs/ymtd/ymtd.xml,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- ymtd.xml  2001/04/22 19:11:11     1.3
  +++ ymtd.xml  2001/04/22 21:08:41     1.4
  @@ -36,12 +36,11 @@
   
   <section name="What are we comparing?">
   <p>
  -This multi page document will compare usage of Turbine/Velocity and
  -Struts/JSP. In both cases, we have a framework of reusable code that
  -makes life easier for building web applications by providing the "Model"
  -and "Controller" portions of the MVC paradigm (Turbine and Struts).
  -There is also a template language that provides the "View" portion (JSP
  -and Velocity).
  +This multi page document will compare usage of Velocity and JSP. In both
  +cases, we have a framework of reusable code that makes life easier for
  +building web applications by providing the "Model" and "Controller"
  +portions of the MVC paradigm (Turbine and Struts). There is also a
  +template language that provides the "View" portion (JSP and Velocity).
   </p>
   
   <p>
  @@ -75,7 +74,7 @@
   We would first like to thank the entire <a
   href="../contributors.html">Velocity</a> and <a
   href="/turbine/contributors.html">Turbine</a> teams for creating such
  -kick ass products. These groups are a 100% volunteer organization and
  +great products. These groups are a 100% volunteer organization and
   some very talented engineers have come together from around the world to
   help make these products a reality and a success. They deserve a round
   of thanks and appreciation for their hard work and dedication.
  
  
  

Reply via email to