Apache
  Home arrow Apache arrow Page 2 - PropertySelection and IPropertySelecti...
The Best Selling PC Migration Utility.
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 
 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

PropertySelection and IPropertySelectionModel in Apache Tapestry
By: Alexander Kolesnikov
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: 5 stars5 stars5 stars5 stars5 stars / 18
    2007-06-12

    Table of Contents:
  • PropertySelection and IPropertySelectionModel in Apache Tapestry
  • Configuring PropertySelection
  • Working on the Model
  • One More Detail
  • So what have we done?

  • 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
     
     
    The Best Selling PC Migration Utility.
     
    ADVERTISEMENT

    The Web Buyer's Guide is your best source for white papers on a wide range of IT products and services. This Week's Featured White Papers: Guide to Virtual Infrastructure Implementation by VMware

    PropertySelection and IPropertySelectionModel in Apache Tapestry - Configuring PropertySelection
    (Page 2 of 5 )

     

    As you already know, the component used to do this kind of job in Tapestry is PropertySelection. Let's configure it in the CelebritiesList page. Here is the addition to the template:

    <form action="" jwcid="@Form">

      <select jwcid="selectCelebrity">

        <option value="1">Angelina Jolie</option>

        <option value="2">Bill Gates</option>

      </select>

      <input type="submit" value="Save"/>

    </form>

    Let's add a property to store the selected celebrity in the page class. We want some other page to be able to display the selected celebrity afterward, so it will be an ASO:

    @InjectState("celebrityOfTheWeek")

    public abstract Celebrity getCelebrityOfTheWeek();

    You already know how to configure an ASO in hivemodule.xml, but here is the addition, just to help you:

    <contribution configuration-id="tapestry.state.ApplicationObjects">

      <state-object name="celebrityOfTheWeek" scope="session">

        <create-instance

          class="com.devshed.tapestry.celebrities.Celebrity"/>

      </state-object>

    </contribution>

    Finally, we need to configure the component in the page specification:

    <component id="selectCelebrity" type="PropertySelection">

      <binding name="model" value="celebrityModel"/>

      <binding name="value" value="celebrityOfTheWeek"/>

    </component>

    The last piece of configuration is to provide a model, which should be an implementation of the IPropertySelectionModel interface. We don't have a proper model yet, so let's just return a null:

    public IPropertySelectionModel getCelebrityModel() {

      return null;

    }

    This will not work however as we need to return a real model. To summarize what we have already done, you can see that the PropertySelection component per se is quite simple, it doesn't take much effort to configure. It is the model that requires the most thought this collaboration, and we do need to write some code to implement it.

    More Apache Articles
    More By Alexander Kolesnikov


       · PropertySelection is a very often used component, and it is important to learn how...
       · Hello:)is it possible to internationalize the values of the PropertySelection?
       · Yes, there are a few ways how you can do that, depending on the task at hand. I was...
       · Thanks :)I'm looking forward to the issue 14. :)
       · May be I missed something, but it seems there is a small issue with the sample you...
       · Well, I understand why you are asking this. Let's look at the whole code of the...
       · Somehow, the closing bracket of the annotation has turned into a winking smiley, but...
       · Hi, great tutorial at all, I'm also looking forward to article 14. Worked this...
     

       

    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




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