Apache
  Home arrow Apache arrow Apache Tapestry and Listener Methods, Conditional Components and PageLink
Dev Shed Forums  
Administration  
AJAX  
Apache  
BrainDump  
DHTML  
Flash  
Java  
JavaScript  
Multimedia  
MySQL  
Oracle  
Perl  
PHP  
Practices  
Python  
Reviews  
Security  
Smartphone Development  
Style-Sheets  
Web Services  
XML  
Zend  
Zope  
Mobile Linux  
App Generation ROI  
IBM® developerWorks  
Forums Sitemap  
E-Commerce Hosting  
Linux Web Hosting  
Managed Hosting  
Small Business Hosting  
VPS Hosting  
Weekly Newsletter

 
Developer Updates  
Free Website Content 
 RSS  Articles
 RSS  Forums
 RSS  All Feeds
Write For Us Get Paid  
Request Media Kit
Contact Us  
Site Map  
Privacy Policy  
Support  
 USERNAME
 
 PASSWORD
 
 
  >>> SIGN UP!  
  Lost Password? 
APACHE

Apache Tapestry and Listener Methods, Conditional Components and PageLink
By: Alexander Kolesnikov
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: starstarstarstarstar / 23
    2007-05-08


    Table of Contents:
  • Apache Tapestry and Listener Methods, Conditional Components and PageLink
  • Passing information to the next page
  • Conditional components
  • PageLink component
  • Deploying the application

  • Rate this Article: Poor Best 
      ADD THIS ARTICLE TO:
      error-file:tidyout.log Del.ici.ous error-file:tidyout.log Digg
      error-file:tidyout.log Blink error-file:tidyout.log Simpy
      error-file:tidyout.log Google error-file:tidyout.log Spurl
      error-file:tidyout.log Y! MyWeb error-file:tidyout.log Furl
    Email Me Similar Content When Posted
    Add Developer Shed Article Feed To Your Site
    Email Article To Friend
    Print Version Of Article
    PDF Version Of Article

     
     
    ADVERTISEMENT


    Apache Tapestry and Listener Methods, Conditional Components and PageLink
    ( Page 1 of 5 )

    Today we continue to explore some of the most fundamental concepts of Tapestry while building one of the simplest Java Web applications. In the previous part of this tutorial we became familiar with properties of Tapestry pages and different ways to configure them. Now we’ll look into the details of writing listener methods.
    A downloadable zip file is available for this article.

    The simplest approach

    We have already used one listener method in our GuessTheWord application. Let’s remind ourselves how we did that.

    In the Home.html template we created a form:

    <form action="" jwcid="secretWordForm">

    … some content …

    </form>

    Then in the Home.page specification we told Tapestry what to do when the form is submitted:

    <component id="secretWordForm" type="Form">

       <binding name="listener" value="listener:onWordSubmit"/>

    </component>

    Which basically means that we want the onWordSubmit() listener method of the Home class to be invoked. And here is the method itself:

    public String onWordSubmit() {

           return "Secret";

    }

    Right now, the listener method is very simple. It does not perform any processing and simply returns a String. Tapestry understands this as “Show the page with this name, please!” and displays the Secret page.

    But the listener method could be even simpler than this, for example:

    public void onWordSubmit() {

       // Do something

    }

    This version returns nothing – so the same page will be redisplayed. But if we put some code inside of the method, it will be executed, of course.

    More often however we want some other page to be shown, and not only that, but we want to somehow prepare the next page before showing it.



     
     
    >>> More Apache Articles          >>> More By Alexander Kolesnikov
     

       

    APACHE ARTICLES

    - Creating a VAMP (Vista, Apache, MySQL, PHP) ...
    - Putting Apache in Jail
    - Containing Intrusions in Apache
    - Server Limits for Apache Security
    - Setting Permissions in Apache
    - Installing Apache
    - Apache Installation and Configuration
    - Apache Tapestry and Custom Components: DateI...
    - Tapestry and AJAX: Autocompleter and InlineE...
    - PropertySelection and IPropertySelectionMode...
    - The DatePicker and Shell Components of Apach...
    - Apache Tapestry: ASO and More Components
    - Apache Tapestry and DirectLink, IoC and DI
    - Making a CelebrityCollector with Apache Tape...
    - Apache Tapestry and Listener Methods, Condit...





    © 2003-2009 by Developer Shed. All rights reserved. DS Cluster 2 hosted by Hostway
    Stay green...Green IT