- Revision
- 228
- Author
- mward
- Date
- 2007-07-05 21:09:11 -0500 (Thu, 05 Jul 2007)
Log Message
continued cleanup of docs
Modified Paths
- trunk/distribution/src/site/content/action-controllers.html
- trunk/distribution/src/site/content/ajax.html
- trunk/distribution/src/site/content/examples/examples.html
- trunk/distribution/src/site/content/examples/hello-world.html
- trunk/distribution/src/site/resources/style/SyntaxHighlighter.css
- trunk/distribution/src/site/resources/style/waffle.css
Diff
Modified: trunk/distribution/src/site/content/action-controllers.html (227 => 228)
--- trunk/distribution/src/site/content/action-controllers.html 2007-07-05 11:37:14 UTC (rev 227) +++ trunk/distribution/src/site/content/action-controllers.html 2007-07-06 02:09:11 UTC (rev 228) @@ -4,19 +4,24 @@ <title>Action Controllers</title> </head> <body> + <h2>Action Controllers</h2> -<p>The terms <b>Action</b> and <b>Controller</b> should be very + +<p> + The terms <b>Action</b> and <b>Controller</b> should be very familiar to those who have experience with web frameworks. An Action originally gets its name from the HTML form tag's <i>action</i> -attributes</p> +attributes +</p> -<textarea class="html:nogutter:nocontrols" name="code"> - <form action="" method="post"> - ... - </form> - </textarea> + <textarea class="html:nogutter:nocontrols" name="code"> + <form action="" method="post"> + ... + </form> + </textarea> -<p>A consolidated pattern for web frameworks is the <a +<p> + A consolidated pattern for web frameworks is the <a href="" - where the action is the controller tier. Hence, often action and controller are used interchangeably.</p> @@ -31,58 +36,60 @@ are responsible for handling user requests. In Waffle these methods are considered <b>ActionMethod</b>s.</p> -<textarea class="java:nogutter:nocontrols" name="code"> + <textarea class="java:nogutter:nocontrols" name="code"> public class ShoppingCartController implements Serializable { private final Cart cart; public ShoppingCartController(Cart cart) { - this.cart = cart; + this.cart = cart; } // This is an ActionMethod public void addToCart(long itemId, int quantity) { - cart.addItem(itemId, quantity); + cart.addItem(itemId, quantity); } // This is also an ActionMethod public void removeFromCart(long itemId, int quantity) { - cart.removeItem(itemId, quantity); + cart.removeItem(itemId, quantity); } } - </textarea> + </textarea> <p>Action Controllers and ActionMethods can be dependent on an HttpServletRequest, HttpServletResponse, HttpSession or ServletContext. In practice most Controllers you'll create will be dependent on custom Factories, Services, DAO's, etc. But if you have a need for these base -Servlet classes it is nice to know that you can get access to them.</p> +Servlet classes it is nice to know that you can get access to them. +</p> + <p>Digging deeper into how an Controller works we will continue with the ShoppingCartController class and add an accessor for a <i>coupon</i> field:</p> -<textarea class="java:nogutter:nocontrols" name="code"> -public class ShoppingCartController implements Serializable { - private String coupon; - ... + <textarea class="java:nogutter:nocontrols" name="code"> + public class ShoppingCartController implements Serializable { + private String coupon; + ... - public String getCoupon() { - return coupon; - } + public String getCoupon() { + return coupon; + } - public void setCoupon(String coupon) { - this.coupon = coupon; - } -} -</textarea> + public void setCoupon(String coupon) { + this.coupon = coupon; + } + } + </textarea> <p>Now lets assume that the ShoppingCartController is requested with the following request string:</p> <p><b>http://localhost:8080/waffle/shoppingCart.waffle?coupon=freebee</b></p> <p>When Waffle's FrontController, <i>WaffleServlet</i>, handles this -request it will first locate the appropriate controller by name "<b>shoppingCart</b>". +request it will first locate the appropriate controller by name "<b>shoppingCart</b>". Then Waffle will attempt to bind each parameter passed as a value to be -set on the Controller. So "<b>coupon=freebee</b>" will set the -field "<i>coupon</i>" on the controller to the value of "<i>freebee</i>". +set on the Controller. So "<b>coupon=freebee</b>" will set the +field "<i>coupon</i>" on the controller to the value of "<i>freebee</i>". (Don't worry parameters that do not correspond to properties on an Controller will <b>NOT</b> cause a failure).</p> <p>Lastly, controller classes do not have to end in the word
Modified: trunk/distribution/src/site/content/ajax.html (227 => 228)
--- trunk/distribution/src/site/content/ajax.html 2007-07-05 11:37:14 UTC (rev 227) +++ trunk/distribution/src/site/content/ajax.html 2007-07-06 02:09:11 UTC (rev 228) @@ -6,97 +6,94 @@ </head> <body> + <h2>Waffle and Ajax</h2> -<h2>Waffle and Ajax</h2> -<p>Waffle was built to be easy to develop with and this ease extends -to Ajax support as well. Utilizing AJAX in Waffle application is -straightforward and simple. The examples here use the <a - href="" _javascript_ Framework</a>.</p> -<h3>Ajax Controller</h3> -<p>We will create a simple Controller with an event (<b>int -random();</b>) that will return a random number between 0 and 10. To make it -more interesting whenever the value equals 5 the event will throw an -Exception.</p> -<div class="source"><pre>public class FoobarController implements Serializable { - private Random random = new Random(); + <p> + Waffle was built to be easy to develop with and this ease extends to Ajax support as well. Utilizing AJAX in Waffle + application is straightforward and simple. The examples here use the + <a href="" _javascript_ Framework</a>. + </p> - /** - * the event - */ - public int random() throws Exception { + <h3>Ajax Controller</h3> + + <p>We will create a simple Controller with an event (<b>int random();</b>) that will return a random number between 0 + and 10. To make it more interesting whenever the value equals 5 the event will throw an Exception. + </p> + + <textarea class="java:nogutter:nocontrols" name="code"> + public class FoobarController implements Serializable { + private Random random = new Random(); + + /** + * the event + */ + public int random() throws Exception { int value = Math.abs(random.nextInt() % 10); if (value == 5) { - throw new Exception("Random Exception!"); + throw new Exception("Random Exception!"); } return value; + } } -}</pre></div> -</div> -<h3>Ajax-ified View</h3> -<p>So we create a simple View that will periodically (every 2 -seconds is the default) request a new value from the Server.</p> -<ul> - <li>We import the prototype _javascript_ file to provide the ajax - foundation</li> - <li>The custom ajax call is <b>new - Ajax.PeriodicalUpdater("random", - "foobar.waffle?method=random");</b> + </textarea> + + <h3>Ajax-ified View</h3> + + <p>So we create a simple View that will periodically (every 2 seconds is the default) request a new value from the Server.</p> + <ul> - <li>The first argument <b>"random"</b> refers to the - element id tag in the html (the <i><div></i>)</li> - <li>The second argument <b>foobar.waffle?method=random</b> - represents what will be periodically called to the server. - <ul> - <li><b>foobar.waffle</b> the Action is registered under the - key value "<i>foobar</i>".</li> - <li>"method=random" signifies that the - "random" ActionMethod method will be called on the - Controller. - <div class="source"><pre><html> -<head> - <script type="text/_javascript_" src="" - <script type="text/_javascript_"> - new Ajax.PeriodicalUpdater("random", "foobar.waffle?method=random"); - </script> -</head> - <h1>Random value from Server: <div id="random"></div></h1> -</html></pre></div> - </li> - </ul> + <li>We import the prototype _javascript_ file to provide the ajax foundation</li> + <li>The custom ajax call is <b>new Ajax.PeriodicalUpdater("random", "foobar.waffle?method=random");</b></li> + <li>The first argument <b>"random"</b> refers to the element id tag in the html (the <i><div></i>)</li> + <li>The second argument <b>foobar.waffle?method=random</b> represents what will be periodically called to the server. + <ul> + <li><b>foobar.waffle</b> the Action is registered under the key value "<i>foobar</i>".</li> + <li><b>method=random</b> signifies that the "random" ActionMethod method will be called on the Controller.</li> + </ul> </li> </ul> - </li> -</ul> -</div> -<h3>Wire it up with the Registrar</h3> -<p>The <i>FoobarController</i> is registered under the name "<i>foobar</i>". -Notice that the Controller is being registered to the Application level -context.</p> -<div class="source"><pre>public class CustomRegistrar extends AbstractRegistrar { - public CustomRegistrar(Registrar delegate) { + + <textarea class="html:nogutter:nocontrols" name="code"> + <html> + <head> + <script type="text/_javascript_" src="" + <script type="text/_javascript_"> + new Ajax.PeriodicalUpdater("random", "foobar.waffle?method=random"); + </script> + </head> + <h1>Random value from Server: <div id="random"></div></h1> + </html> + </textarea> + + <h3>Wire it up with the Registrar</h3> + + <p>The <i>FoobarController</i> is registered under the name "<i>foobar</i>". Notice that the Controller is being + registered to the Application level context. + </p> + + <textarea class="java:nogutter:nocontrols" name="code"> + public class CustomRegistrar extends AbstractRegistrar { + public CustomRegistrar(Registrar delegate) { super(delegate); - } + } - public void application() { - register("foobar", FoobarController.class); + public void application() { + register("foobar", FoobarController.class); + } } -}</pre></div> -</div> -<h3>Partial page rendering</h3> -<p>By simply having an <i>ActionMethod</i> invoked through an -asynchronous call which return <i>View</i>'s you'll be able to build -your web applications to take advantage of partial page rendering.</p> -<p>TODO ... need example!!! ...</p> -</div> -<div id="footer"> -<div class="xright">© 2007</div> -<div class="clear"> -<hr /> -</div> -</div> + </textarea> + <h3>Partial page rendering</h3> + + <p> + By simply having an <i>ActionMethod</i> invoked through an asynchronous call which return <i>View</i>'s you'll be + able to build your web applications to take advantage of partial page rendering. + </p> + + <p>TODO ... need example!!! ...</p> + </body> </html>
Modified: trunk/distribution/src/site/content/examples/examples.html (227 => 228)
--- trunk/distribution/src/site/content/examples/examples.html 2007-07-05 11:37:14 UTC (rev 227) +++ trunk/distribution/src/site/content/examples/examples.html 2007-07-06 02:09:11 UTC (rev 228) @@ -1,12 +1,52 @@ -<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" + "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html> - <head> - <title>Waffle Example Projects</title> - </head> - <body> - - - <h2>We have three examples:</h2><h3>Simple</h3><p>Source: <a href="" example has four built in mini-apps:</p><p>People management (a list of people you can add to, view, edit etc) Ajax Automobile Calulator</p><p>Waffle, for this example, uses a 'pragma' style of method encoding (the way web methods are mapped to Java ones).</p></div><h3>Paranamer</h3><p>Source: <a href="" example has four built in mini-apps:</p><p>People management (a list of people you can add to, view, edit etc) Ajax Automobile Calulator</p><p>Waffle, for this example, uses a 'Paranamer' for method encoding, resulting in smaller URLs, and more 'convention-based' design</p></div><h3>Paranamer + FreeMarker + Sitemesh</h3><p>Source: <a href="" only contains the People app that the Paranamer example above had.</p><p>It renders the page with <a href="" rather than JSP.</p><p>This allows for us to edit the pages in Adobe's Dreamweaver without additional plugins in a WYSIWYG way.</p><p>It also decorates everything with <a href="" though (0 lines of additional Java)</p><p>This allows us to separate the site's styling and navigation from content.</p></div> - </body> +<head> + <title>Waffle Example Projects</title> +</head> +<body> +<h2>We have three examples:</h2> + +<h3>Simple</h3> + +<p> + Source: <a href="" +</p> + +<p>This example has four built in mini-apps:</p> + +<p>People management (a list of people you can add to, view, edit etc) Ajax Automobile Calulator</p> + +<p> + Waffle, for this example, uses a 'pragma' style of method encoding (the way web methods are mapped to Java ones). +</p> + +<h3>Paranamer</h3> + +<p>Source: <a href="" +</p> + +<p>This example has four built in mini-apps:</p> + +<p>People management (a list of people you can add to, view, edit etc) Ajax Automobile Calulator</p> + +<p>Waffle, for this example, uses a 'Paranamer' for method encoding, resulting in smaller URLs, and more + 'convention-based' design</p> + +<h3>Paranamer + FreeMarker + Sitemesh</h3> + +<p>Source: <a href="" + +<p>This only contains the People app that the Paranamer example above had.</p> + +<p>It renders the page with <a href="" rather than JSP.</p> + +<p>This allows for us to edit the pages in Adobe's Dreamweaver without additional plugins in a WYSIWYG way.</p> + +<p>It also decorates everything with <a href="" though (0 lines of additional Java)</p> + +<p>This allows us to separate the site's styling and navigation from content.</p> +</body> + </html>
Modified: trunk/distribution/src/site/content/examples/hello-world.html (227 => 228)
--- trunk/distribution/src/site/content/examples/hello-world.html 2007-07-05 11:37:14 UTC (rev 227) +++ trunk/distribution/src/site/content/examples/hello-world.html 2007-07-06 02:09:11 UTC (rev 228) @@ -3,37 +3,88 @@ <html> <head> <title>Hello World example</title> - </head> + </head> <body> - - - <h2>Example: Hello World</h2><p>Our first example is the obligatory <b>Hello World</b>. However it'll provide a good overview on how simple it is to create Waffle web applications. The process can be broken down into 3 simple steps:</p><ol type="1"><li>Create a Controller</li><li>Register that Controller with the Registrar</li><li>Create the View</li></ol><h3>Controller</h3><p>The Controller object which will be responsible for handling user requests. This class is simply a POJO and is <b>not</b> required to extend from any Waffle base classes. The Controller below below does NOT have any ActionMethods.</p><div class="source"><pre>public class HelloWorldController { - public String getGreeting() { - return "Hello World!"; + <h2>Example: Hello World</h2> + + <p> + Our first example is the obligatory <b>Hello World</b>. However it'll provide a good overview on how simple it is + to create Waffle web applications. The process can be broken down into 3 simple steps: + </p> + + <ol type="1"> + <li>Create a Controller</li> + <li>Register that Controller with the Registrar</li> + <li>Create the View</li> + </ol> + + <h3>Controller</h3> + + <p> + The Controller object which will be responsible for handling user requests. This class is simply a POJO and is + <b>not</b> required to extend from any Waffle base classes. The Controller below below does NOT have any ActionMethods. + </p> + + <textarea class="java:nogutter:nocontrols" name="code"> + public class HelloWorldController { + + public String getGreeting() { + return "Hello World!"; + } } -}</pre></div></div><h3>Registrar</h3><p>All Controllers need to be registered with Waffle. This is done through the Registrar. Line <b>9</b> in the <i>MyRegistrar</i> class below registers the <i>HelloWorldAction</i> under the name <b>"helloworld"</b>. This Registrar will need to referenced in the <a href="" class="source"><pre>public class MyRegistrar extends AbstractRegistrar { + </textarea> - public MyRegistrar(Registrar delegate) { + <h3>Registrar</h3> + + <p> + All Controllers need to be registered with Waffle. This is done through the Registrar. Line <b>9</b> in the + <i>MyRegistrar</i> class below registers the <i>HelloWorldAction</i> under the name <b>"helloworld"</b>. + This Registrar will need to referenced in the <a href="" + </p> + + <textarea class="java:nogutter:nocontrols" name="code"> + public class MyRegistrar extends AbstractRegistrar { + + public MyRegistrar(Registrar delegate) { super(delegate); - } + } - public void application() { - register("helloworld", HelloWorldAction.class); + public void application() { + register("helloworld", HelloWorldAction.class); + } } -}</pre></div></div><h3>View (helloworld.jspx)</h3><p>A View in Waffle is no different than what you would expect from any Java based web framework. Waffle exposes the underlying Controller for use in your View under the key <b>controller</b>. Notice line 12 <b>${controller.greeting}</b>, this is calling the <i>greeting</i> property exposed in the <i>HelloWorldController</i>.</p><p>The example below uses <b>jspx</b> but <a href="" and <a href="" </a> are also supported.</p><div class="source"><pre><?xml version="1.0" encoding="UTF-8"?> -<html xmlns="http://www.w3.org/1999/xhtml" - xmlns:jsp="http://java.sun.com/JSP/Page"> + </textarea> -<jsp:output doctype-root-element="html" - doctype-public="-//W3C//DTD XHTML 1.0 Transitional//EN" - doctype-system="http://www.w3c.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"/> -<jsp:directive.page contentType="text/html;charset=UTF-8"/> + <h3>View (helloworld.jspx)</h3> -<head><title>Hello World Controller</title></head> -<body> -<h1>${controller.greeting}</h1> -</body> -</html></pre></div><h4>Running...</h4><img src="" /></div></div> + <p> + A View in Waffle is no different than what you would expect from any Java based web framework. Waffle exposes the + underlying Controller for use in your View under the key <b>controller</b>. Notice line 12 + <b>${controller.greeting}</b>, this is calling the <i>greeting</i> property exposed in the + <i>HelloWorldController</i>.</p><p>The example below uses <b>jspx</b> but + <a href="" and + <a href="" </a> are also supported. + </p> + + <textarea class="xml:nogutter:nocontrols" name="code"> + <?xml version="1.0" encoding="UTF-8"?> + <html xmlns="http://www.w3.org/1999/xhtml" + xmlns:jsp="http://java.sun.com/JSP/Page"> + + <jsp:output doctype-root-element="html" + doctype-public="-//W3C//DTD XHTML 1.0 Transitional//EN" + doctype-system="http://www.w3c.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"/> + <jsp:directive.page contentType="text/html;charset=UTF-8"/> + + <head><title>Hello World Controller</title></head> + <body> + <h1>${controller.greeting}</h1> + </body> + </html> + </textarea> + + <h4>Running...</h4> + <img src="" /> </body> </html>
Modified: trunk/distribution/src/site/resources/style/SyntaxHighlighter.css (227 => 228)
--- trunk/distribution/src/site/resources/style/SyntaxHighlighter.css 2007-07-05 11:37:14 UTC (rev 227) +++ trunk/distribution/src/site/resources/style/SyntaxHighlighter.css 2007-07-06 02:09:11 UTC (rev 228) @@ -39,7 +39,7 @@ .dp-highlighter .columns div { border-left: 3px solid #6CE26C; - background-color: #000; + background-color: #22344A; padding-left: 10px; line-height: 14px; } @@ -64,7 +64,7 @@ .dp-highlighter ol li.alt { - background-color: #000; + background-color: #22344A; } .dp-highlighter ol li span
Modified: trunk/distribution/src/site/resources/style/waffle.css (227 => 228)
--- trunk/distribution/src/site/resources/style/waffle.css 2007-07-05 11:37:14 UTC (rev 227) +++ trunk/distribution/src/site/resources/style/waffle.css 2007-07-06 02:09:11 UTC (rev 228) @@ -3,7 +3,7 @@ } #banner img { - padding: 4px 0px 4px 20px; + padding: 4px 0 4px 20px; } #breadcrumbs { @@ -20,7 +20,7 @@ #navColumn h1 { font-size: 10pt; - border-bottom: 1px solid #aaaaaa; + border-bottom: 1px solid #aaa; padding-top: 12px; margin-right: 20px; color: #66665c; @@ -46,7 +46,7 @@ margin-top: 50px; font-size: 0.8em; position: fixed; - bottom: 0px; + bottom: 0; } #uads { @@ -82,8 +82,8 @@ margin: 0; font-family: "Trebuchet MS", Arial, Verdana; font-size: 0.84em; - color: #555555; - background-color: #FFFFFF; + color: #555; + background-color: #FFF; text-align: left; padding: 0 0 10px 0; } @@ -106,11 +106,11 @@ } a:link { - color: #666699; + color: #669; } a:visited { - color: #666699; + color: #669; } a:active,a:hover {
To unsubscribe from this list please visit:
