Apache
  Home arrow Apache arrow Apache Tapestry and Listener Methods, ...
Dev Shed Forums 
Administration  
Apache  
BrainDump  
DHTML  
Flash  
Java  
JavaScript  
Multimedia  
MySQL  
Oracle  
Perl  
PHP  
Practices  
Python  
Reviews  
Security  
Style-Sheets  
Web Services  
XML  
Zend  
Zope  
Forums Sitemap 
IBM® developerWorks 
Dedicated Servers 
E-Commerce Hosting 
Linux Web Hosting 
Managed Hosting 
Small Business Hosting 
Download TestComplete 
VPS Hosting 
Weekly Newsletter

 
Developer Updates  
Free Website Content 
IBM Developerworks
 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: 5 stars5 stars5 stars5 stars5 stars / 19
    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:
      Del.ici.ous Digg
      Blink Simpy
      Google Spurl
      Y! MyWeb 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

    Anyone looking for a way to modernize legacy data or easily migrate to a more cost-effective database without sacrificing functionality will benefit from this seminar. View the Intro to Advantage Database Server now!

    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


       · By the way I am hosting my website at the same provider I've mentioned in the...
       · This is a TestThis is a TestThis is a TestThis is a TestThis is a TestThis is a...
       · HiI couldn't run my application with the following sentence in Secret...
       · My guess is that you had a setter but didn't have a getter. Tapestry needs to...
       · HiYes, it includes the getter abstract method.My class is:public abstract...
       · Ah! This might be the problem. You need to accept a parameter in the...
       · It works!. I supposed an abstract method (with Tapestry) shouldn't have parameters....
       · Okay, thats good.Well, there should be at least one article every week....
       · Can you plese explain the folowing line of code:Secret nextPage =...
       · First of all, we ask Tapestry to give us a page named "Secret": getPage("Secret")....
     

       

    APACHE ARTICLES

    - 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...
    - The Properties of Tapestry Pages

     
    Accelerating Trading Partner Performance
     
    Competing on Analytics
     
    Cost Effective Scaling with Virtualization and Coyote Point Systems
     
    Five Checkpoints to Implementing IP Telephony
     
    Hosted Email Security: Staying Ahead of New Threats
     




    © 2003-2008 by Developer Shed. All rights reserved. DS Cluster 6 hosted by Hostway