- Apache Tapestry 教程
- Apache Tapestry - 主页
- Apache Tapestry - 概述
- Apache Tapestry - 架构
- Apache Tapestry - 安装
- Apache Tapestry - 快速入门
- Apache Tapestry - 项目布局
- 约定优于配置
- Apache Tapestry - 注释
- 页面和组件
- Apache Tapestry - 模板
- Apache Tapestry - 组件
- 内置组件
- 表单和验证组件
- Apache Tapestry - Ajax 组件
- Apache Tapestry - Hibernate
- Apache Tapestry - 存储
- 高级功能
- Apache Tapestry 有用资源
- Apache Tapestry - 快速指南
- Apache Tapestry - 有用的资源
- Apache Tapestry - 讨论
Apache Tapestry - 项目布局
以下是Maven Quickstart CLI创建的源代码的布局。此外,这是标准 Tapestry 应用程序的建议布局。
├── build.gradle
├── gradle
│ └── wrapper
│ ├── gradle-wrapper.jar
│ └── gradle-wrapper.properties
├── gradlew
├── gradlew.bat
├── pom.xml
├── src
│ ├── main
│ │ ├── java
│ │ │ └── com
│ │ │ └── example
│ │ │ └── MyFirstApplication
│ │ │ ├── components
│ │ │ ├── data
│ │ │ ├── entities
│ │ │ ├── pages
│ │ │ └── services
│ │ ├── resources
│ │ │ ├── com
│ │ │ │ └── example
│ │ │ │ └── MyFirstApplication
│ │ │ │ ├── components
│ │ │ │ ├── logback.xml
│ │ │ │ └── pages
│ │ │ │ └── Index.properties
│ │ │ ├── hibernate.cfg.xml
│ │ │ └── log4j.properties
│ │ └── webapp
│ │ ├── favicon.ico
│ │ ├── images
│ │ │ └── tapestry.png
│ │ ├── mybootstrap
│ │ │ ├── css
│ │ │ │ ├── bootstrap.css
│ │ │ │ └── bootstrap-theme.css
│ │ │ ├── fonts
│ ├── glyphicons-halflings-regular.eot
│ │ │ │ ├── glyphicons-halflings-regular.svg
│ │ │ │ ├── glyphicons-halflings-regular.ttf
│ │ │ │ ├── glyphicons-halflings-regular.woff
│ │ │ │ └── glyphicons-halflings-regular.woff2
│ │ │ └── js
│ │ └── WEB-INF
│ │ ├── app.properties
│ │ └── web.xml
│ ├── site
│ │ ├── apt
│ │ │ └── index.apt
│ │ └── site.xml
│ └── test
│ ├── conf
│ │ ├── testng.xml
│ │ └── webdefault.xml
│ ├── java
│ │ └── PLACEHOLDER
│ └── resources
│ └── PLACEHOLDER
└── target
├── classes
│ ├── com
│ │ └── example
│ │ └── MyFirstApplication
│ │ ├── components
│ │ ├── data
│ │ ├── entities
│ │ ├── logback.xml
│ │ ├── pages
│ │ │ └── Index.properties
│ │ └── services
│ ├── hibernate.cfg.xml
│ └── log4j.properties
├── m2e-wtp
│ └── web-resources
│ └── META-INF
│ ├── MANIFEST.MF
│ └── maven
│ └── com.example
│ └──MyFirstApplication
│ ├── pom.properties
│ └── pom.xml
├── test-classes
│ └── PLACEHOLDER
└── work
├── jsp
├── sampleapp.properties
└── sampleapp.script
默认布局的排列方式类似于WAR 内部文件格式。使用 WAR 格式有助于无需打包和部署即可运行应用程序。此布局只是一个建议,但如果在部署时将应用程序打包为正确的 WAR 格式,则应用程序可以以任何格式进行排列。
源代码可以分为以下四个主要部分。
Java 代码- 所有 java 源代码都放置在/src/main/java文件夹下。Tapestry 页面类放置在“Pages”文件夹下,Tapestry 组件类放置在 Components 文件夹下。Tapestry 服务类位于 services 文件夹下。
ClassPath 资源- 在 Tapestry 中,大多数类都有关联的资源(XML 模板、JavaScript 文件等)。这些资源位于/src/main/resources文件夹下。Tapestry 页面类在“Pages”文件夹下有其关联的资源,Tapestry 组件类在 Components 文件夹下有其关联的资源。这些资源被打包到WAR的WEB-INF/classes文件夹中。
上下文资源- 它们是 Web 应用程序的静态资源,例如图像、样式表和 JavaScript 库/模块。它们通常放置在 /src/main/webapp文件夹下,称为Context Resources。另外,Web 应用程序描述文件(Java Servlet 的)web.xml 放置在上下文资源的WEB-INF文件夹下。
测试代码- 这些是用于测试应用程序的可选文件,并放置在src/test/java和src/test/资源文件夹下。它们没有打包到 WAR 中。