Java Tutorial - Java Script :
Creating the Tea Template:
It is much easier to link your project to a TeaServlet in order for Kettle to get configuration information such as the Template Path and ClassPath, otherwise you will have to manually configure these yourself. Manual configuration is discussed in the Kettle user manual.
If all is well, you should be able to invoke the following URL from your browser and see your first Tea application in action
We can see from Figure 6.5 that the output is what we expected. Because the request parameter was undefined, the value of myCity was evaluated as null and was changed programmatically by our application to be “Fort Myers .”
Now, pass the name of your city to the application from the command line; if your city is Nashville , the command would look like the following:
As you can see in Figure 6.6, when you define the city parameter (Nashville in this case), the application passes it to the template and subsequently returns it to the browser. These simple examples show how the Tea environment provides a simple framework for creating Web applications that enforce the separation of data acquisition from the presentation layer. There are many powerful features we have not shown in this chapter, such as sophisticated flow-control capabilities and a rich set of standard functions that can be used to access request parameters and aid in sending a response to the client.
One other interesting piece of the Tea environment is the Trove library. The Trove library consists of:
A logging API useful for configuring and capturing events to be logged
Utility classes that are useful for thread, HTTP, socket management, and other tasks
A Class File API useful for creating Java Class files from high-level methods
Clearly, the powerful tools provided by the Walt Disney Internet Group in the Tea suite of products, its simplicity, and its enforcement of separation of data and presentation makes it a good potential choice for Web-application development.
