目录

Apache Tapestry - 项目布局( Project Layout)

以下是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 Internal File Format 。 使用WAR格式有助于在不进行打包和部署的情况下运行应用程序。 这种布局只是一个建议,但如果在部署时将应用程序打包成适当的WAR格式,则可以以任何格式安排应用程序。

源代码可分为以下四个主要部分。

  • Java Code - 所有java源代码都放在/src/main/java文件夹下。 Tapestry页面类放在“Pages”文件夹下,Tapestry组件类放在components文件夹下。 Tapestry服务类位于services文件夹下。

  • ClassPath Resources - 在Tapestry中,大多数类都有相关的资源(XML模板,JavaScript文件等)。 这些资源位于/src/main/resources文件夹下。 Tapestry页面类在“Pages”文件夹下有相关的资源,Tapestry组件类在Components文件夹下有相关的资源。 这些资源打包到WAR的WEB-INF/classes文件夹中。

  • Context Resources - 它们是Web应用程序的静态资源,如Images,Style Sheet和JavaScript Library / Modules. They are usually placed under the /src/main/webapp / Modules. They are usually placed under the /src/main/webapp文件夹下,它们被称为Context Resources 。 此外,Web应用程序描述文件(Java Servlet),web.xml放在上下文资源的WEB-INF文件夹下。

  • Testing Code - 这些是用于测试应用程序的可选文件,位于src/test/javasrc/test/ Resources文件夹下。 它们没有打包成WAR。

↑回到顶部↑
WIKI教程 @2018