Summary

Definitions

Overview

Illustration 1
   Page Template
   Page Specification
   Page Class
   Application Specification
   -web.xml

Illustration 2

Illustration 3

The Framework - a flyby

Conclusion

Biography

Resources

web.xml
<?xml version="1.0"?>
<!DOCTYPE web-app PUBLIC
    "-//Sun Microsystems, Inc.//DTD Web Application 2.2//EN"
    "http://java.sun.com/j2ee/dtds/web-app_2_2.dtd">

<web-app>
    <display-name>Tapestry Welcome Application</display-name>

    <servlet>
        <servlet-name>Welcome</servlet-name>
        <servlet-class>org.apache.tapestry.ApplicationServlet</servlet-class>
        <load-on-startup>0</load-on-startup>
    </servlet>

    <servlet-mapping>
        <servlet-name>Welcome</servlet-name>
        <url-pattern>/app</url-pattern>
    </servlet-mapping>

    <session-config>
        <session-timeout>15</session-timeout>
    </session-config>

    <welcome-file-list>
        <welcome-file>index.html</welcome-file>
    </welcome-file-list>
</web-app>
Listing 5. web.xml
Tapestry applications have a single entry point servlet, ApplicationServlet, that acts as a gateway/gatekeeper. A request that gets delegated to a Tapestry application is sucked in by the framework's ApplicationServlet, processed, packaged and finally handed off to the application, in the form of Objects instead of the cryptic request parameters, for further processing. org.apache.tapestry.ApplicationServlet is the framework provided default servlet that may be extended for special needs (a very rare situation). The application servlet is by convention (not a requirement) mapped to the /app URL pattern within the application context. The AppilicationServlet is specified in the web.xml as all Servlets in a Java web application. The web.xml file is placed, per Java specifications, under the WEB-INF folder of the application context. Now if we ran our Welcome example application within Tomcat, running at port 8080, within context Welcome, the request URL http://localhost:8080/Welcome/app will take us to the Home Page of our Welcome application that we just built.
<< Previous Next >>