Hello, Tapestry 3.0Mechiland, Jul 2003
This article mainly introduces a configuration method of a simple case Tapestry in the TapeStry3.0 environment, which is designed to help developers are familiar with the 3.0 environment. Due to the Tutorial document provided by Tapestry (http://jakarta.apache.org/tapestry/) is based on 2.x, this greatly improves the difficulty of learning. For the introduction of TapeStry2.x and the Tapestry framework, please refer to the transparent article of the 7th "Programmer" magazine, no more.
2.X to 3.0 changes I have too much time to study - after all, the time is limited, just understand the concept, 3.0 is coming, the name of the package has changed, and the DTD has changed, some configuration The method is not the same, so this article is mainly discussed 3.0, for the difference in 2.x and 3.0, try not to compare; if there is a fault in the text, please advise.
1 development environment
Tomcat5.0, Win2000 Server, TapeStry 3.0B2 Development Tools: Editplus2.11:) (Small project, no need to use aircraft carrier)
2 Let's get started!
OK, let us start this "Hello, TapeStry3.0"!
First, create a directory to save your project, assume the x: / TapeStry / Hello (replace it later); and finally establish the following file structure: -Web-inf - classes - lib
Put a Home.html in the $ HOME root directory, the code as follows:
Code List 1: Home.html
This is our home page.
Then put a web.xml in $ home / web-inf / below, unexpected, this web.xml is so simple, and it is very different from the TapeStry2.x documentation ~~
XML Version = "1.0"?>
Slightly explanation: Filter named redirect is used to turn, note that where INIT-PARAM is used to control where to go, if not or set is incorrect, turn to the default place (/ app). According to the situation we are configured, it should be when accessing / go to the servlet to / h. Of course, this setting is only when the
People who read the old TUTORIAL will be strange, where is the org.apache.tapestry.application-specification? By default, TapeStry will find the same .application, which is the same .application in / web-inflight, in addition, the configuration of Application is very simple, for our Hello, Tapestry simple use case, no. Application is also possible. But for the form of the form, we plus it: put the Hello.application file below $ home / web-inflight (with Web.xml)
XML Version = "1.0"?>
Code Example 4: Home.page
Don't you know where to put this file? Put it below $ home / web-inf!
OK, the last step, copy all of the Workbench example of TapeStry to $ HOME / Web-INF / LIB.
3 deployment
The deployment method is very simple, you can use the JAR tool to make the $ home directory into a WAR package, or copy the entire $ home directory to $ Tomcat_home / WebApps. Whether you use that way, after deployment, open your browser, type the address: http:// localhost: 8080 / hello, is it displayed below?
4 small knot
In TapeStry3.0, the deployment application is easier, this article is simpler, many steps can be ignored (in this case, hello.application and home.page can be ignored), but in complex applications, If the Workbench example of TapeStry comes, it cannot be ignored. About Tapestry's other features, the author is studying. Tapestry is an excellent development framework if you are interested, or what is incorrect in this article, Welcome Criticism, Email: Mechiland@163.net