Home arrow Apache arrow Page 2 - The DatePicker and Shell Components of Apache Tapestry

Shell component - Apache

In the previous article in this series we came to adding a component for accepting a date input, to specify the date of birth for the newly added celebrity. DatePicker, a standard Tapestry component, is an excellent choice for this, and we are going to learn today how to add a DatePicker to a page.

  1. The DatePicker and Shell Components of Apache Tapestry
  2. Shell component
  3. Possible deficiencies of DatePicker
  4. To cache or not to cache?
By: Alexander Kolesnikov
Rating: starstarstarstarstar / 16
June 05, 2007

print this article



The Shell component is quite useful and we are going to look at it properly in a later article in this series. For now, just a brief introduction: Shell is used to add to an HTML page a number of standard elements. It adds a <!DOCTYPE ...> element, a <head> element with a <title> in it, can optionally add references to style sheets, and also adds all the necessary code to make the Dojo toolkit accessible for the page.

The only required binding for this component is title, which is a title for the page. Let's define this component implicitly in the opening <html> tag of the page:

<html jwcid="@Shell" title="Add New Celebrity">

Now we have all JavaScript libraries available, but another problem arises: Shell will automatically insert its own DOCTYPE and head elements, in addition to already existing ones. And we don't want our page to have two heads, do we? So let's mark those that we've written ourselves for removal at runtime:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"



<html jwcid="@Shell" title="Add New Celebrity">

<head jwcid="$remove$">

   <title>Add New Celebrity</title>


Note that the page template still can be previewed by any browser as a browser simply ignores those things it doesn't understand.

The last step in preparations is to make the <body> element of the page template a Tapestry's Body component. This is very simple:

<body jwcid="@Body">

The purpose of this is to tell Tapestry where the page's <body> tag is located, as it will need to insert two bits of JavaScript, required specifically for DatePicker, directly under that tag.

With this, we have completed the preparations for using a DatePicker, so run the application and see how the new component works. Initially, you should see a small calendar image to the right of the Birth Date text box, like this:

When you click this image, a glorious calendar opens, allowing you to pick a date:

Finally, the chosen date is inserted into the text box:

The component is quite impressive, but it has a few deficiencies.

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

blog comments powered by Disqus
escort Bursa Bursa escort Antalya eskort


- Apache Unveils Cassandra 1.2
- Apache on ARM Chips? Dell and Calxeda Help M...
- The Down Side of Open Source Software
- VMware Unveils Serengeti for Apache Hadoop
- SAP Takes Steps to Improve Hadoop Integration
- Looking to Hone Apache Hadoop Skills?
- How to Install Joomla on WAMPP
- Working with XAMPP and Wordpress
- GUI Available for Apache Camel
- Reduce Server Load for Apache and PHP Websit...
- Creating a VAMP (Vista, Apache, MySQL, PHP) ...
- Putting Apache in Jail
- Containing Intrusions in Apache
- Server Limits for Apache Security
- Setting Permissions in Apache

Developer Shed Affiliates


Dev Shed Tutorial Topics: