You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tapestry.apache.org by nc...@apache.org on 2003/01/26 13:19:25 UTC

cvs commit: jakarta-tapestry/examples/Tutorial2/src/tutorial/pagelinking SecondPage.java SecondPage.page SecondPage.html

nclayton    2003/01/26 04:19:25

  Modified:    examples/Tutorial2/src/tutorial/pagelinking SecondPage.page
                        SecondPage.html
  Added:       examples/Tutorial2/src/tutorial/pagelinking SecondPage.java
  Log:
  Added example code showing simple actions
  
  Revision  Changes    Path
  1.2       +20 -3     jakarta-tapestry/examples/Tutorial2/src/tutorial/pagelinking/SecondPage.page
  
  Index: SecondPage.page
  ===================================================================
  RCS file: /home/cvs/jakarta-tapestry/examples/Tutorial2/src/tutorial/pagelinking/SecondPage.page,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- SecondPage.page	3 Oct 2002 15:49:02 -0000	1.1
  +++ SecondPage.page	26 Jan 2003 12:19:25 -0000	1.2
  @@ -1,11 +1,28 @@
   <?xml version="1.0" encoding="UTF-8"?>
   <!-- $Id$ -->
  -<!DOCTYPE page-specification PUBLIC 
  -	"-//Howard Lewis Ship//Tapestry Specification 1.3//EN" 
  +<!DOCTYPE page-specification PUBLIC
  +	"-//Howard Lewis Ship//Tapestry Specification 1.3//EN"
   	"http://tapestry.sf.net/dtd/Tapestry_1_3.dtd">
   
  -<page-specification class="net.sf.tapestry.html.BasePage">
  +<page-specification class="tutorial.pagelinking.SecondPage">
   	<component id="homePage" type="PageLink">
   		<static-binding name="page">Home</static-binding>
   	</component>
  +
  +    <component id="form" type="Form">
  +        <binding name="stateful" expression="false"/>
  +    </component>
  +
  +    <component id="result" type="InsertText">
  +        <binding name="value" expression="result"/>
  +    </component>
  +
  +    <component id="linkListener" type="DirectLink">
  +        <binding name="listener" expression="listeners.linkListener"/>
  +        <binding name="stateful" expression="false"/>
  +    </component>
  +
  +    <component id="buttonListener" type="Submit">
  +        <binding name="listener" expression="listeners.buttonListener"/>
  +    </component>
   </page-specification>
  
  
  
  1.2       +14 -2     jakarta-tapestry/examples/Tutorial2/src/tutorial/pagelinking/SecondPage.html
  
  Index: SecondPage.html
  ===================================================================
  RCS file: /home/cvs/jakarta-tapestry/examples/Tutorial2/src/tutorial/pagelinking/SecondPage.html,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- SecondPage.html	3 Oct 2002 15:49:02 -0000	1.1
  +++ SecondPage.html	26 Jan 2003 12:19:25 -0000	1.2
  @@ -5,8 +5,20 @@
   </head>
   <body>
   <h1>Page Two</h1>
  -Well, here we are! 
  -Click <span jwcid="homePage">here</span> to go back to the home page.
  +
  +<center>
  +<table border=0>
  +    <tr><th>Well, here we are! Let have some Action!</th></tr>
  +    <tr><td><hr></td></tr>
  +    <tr><td>Click <span jwcid="homePage">here</span> to go back to the home page.</td></tr>
  +    <tr><td>Click <span jwcid="linkListener">here</span> to invoke a <b>DirectLink</b> listener</td></tr>
  +    <form jwcid="form">
  +        <tr><td>Click <span jwcid="buttonListener">here</span> to invoke a <b>Submit</b> listener</td></tr>
  +    </form>
  +
  +    <!-- This part shows the 'result' of the listener -->
  +    <tr><td><hr></td></tr>
  +    <tr><td><span jwcid="result"/></td></tr>
   
   </body>
   </html>
  
  
  
  1.1                  jakarta-tapestry/examples/Tutorial2/src/tutorial/pagelinking/SecondPage.java
  
  Index: SecondPage.java
  ===================================================================
  package tutorial.pagelinking;
  
  import net.sf.tapestry.html.BasePage;
  import net.sf.tapestry.IRequestCycle;
  import net.sf.tapestry.RequestCycleException;
  
  /**
   * Provides the listeners and a place to store a simple 'result' string
   * that can be shown back to the user.
   */
  public class SecondPage extends BasePage {
      public void linkListener(IRequestCycle cycle) throws RequestCycleException {
          result = "The link listener was called - which is a good thing.";
      }
  
      public void buttonListener(IRequestCycle cycle) throws RequestCycleException {
          result = "The submit listener was called - which is also a good thing.";
      }
  
      public String getResult() {
          return result;
      }
  
      /** Clean up */
      public void detach() {
          super.detach();
          result = null;
      }
  
      private String result;
  }