HomeApache Page 4 - The DatePicker and Shell Components of Apache Tapestry
To cache or not to cache? - 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.
In an earlier article I've advised you to disable caching page templates and page specifications by Tapestry, so you can immediately see any changes you have made to these files. However, soon after that a Tapestry developer emailed me to point out that disabling caching is not a good idea. You can read his message in full at the discussion page for that article.
I do agree that it is not a good idea to disable caching when working on a big complicated project, but I am tempted to think that it is still acceptable for our simple projects. On the other hand, it is better to set everything up properly from the very beginning, so we need an alternative solution. How do we reload page templates and specifications without disabling caching?
In my current project I avoid this issue by using a Maven script that rebuilds and redeploys the whole project when I need to test it. While the script works, I can take a breather, which is okay for me, but can madden some of the more impatient folks. Another option is to reload the project in Tomcat's Application Manager. You can find a detailed description of how to do this in the first free chapter of the book by Kent Tong (a link to it is given in the first article of this series).
However, NetBeans offers yet another option, and it has worked well for me so far. As soon as you've made a change to a page template or specification, right-click on the project in the Projects view and select Clean and Build Project. Or maybe just Clean Project will do the same thing. When you run the project after such a cleanup, everything is deployed anew, and you can see all your changes.
I am still quite new to NetBeans (but I like this IDE), so suggestions from NetBeans gurus are welcome.
What comes next
In the next issue we are going to look into the details of how the PropertySelection component works and why IPropertySelectionModel is a powerful and flexible solution for providing options to a drop-down list.