Tapestry 5 Set Up

2024-02-08 02:58
文章标签 set tapestry

本文主要是介绍Tapestry 5 Set Up,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!

使用任何一个框架之前需要学会建立一个空白的应用程序,后续的开发可以建立在这个空白的应用程序之上.那么在Tapestry5中如何建立一个简单的空白应用程序的,以下用两种方法说明:
1. maven 2
Maven 2 也许是一般万能钥匙,使用Maven 2 的Quick Start Archetype可以建立一个简单的Tapestry 5 空白应用程序,只需要输入如下命令即可,

mvn archetype:create -DarchetypeGroupId=org.apache.tapestry -DarchetypeArtifactId=quickstart -DgroupId=net.java.dev.teamware -DartifactId=sharequestiont5

     将建立如下目录结构的应用程序
            sharequestiont5
|____.classpath
|____.project
|____pom.xml
|____src
| |____main
| | |____java
| | | |____net
| | | | |____java
| | | | | |____dev
| | | | | | |____teamware
| | | | | | | |____pages
| | | | | | | | |____Start.java
| | | | | | | |____services
| | | | | | | | |____AppModule.java
| | |____resources
| | | |____log4j.properties
| | |____webapp
| | | |____favicon.ico
| | | |____Start.tml
| | | |____WEB-INF
| | | | |____web.xml
| |____test
| | |____java
| | | |____PLACEHOLDER
| | |____resources
| | | |____PLACEHOLDER
     启动应用程序
     mvn jetty:run
      
     看到如下输出说明jetty服务器已经启动了:
     2008-05-28 22:12:57.902::INFO:  Started SelectChannelConnector@0.0.0.0:8080
     [INFO] Started Jetty Server

     在浏览器中输入如下链接: http://localhost:8080/sharequestiont5
     
    看到上述页面说明Tapestry 5 空白应用程序建立完毕.
    
    使用IDE打开
     如果想使用IDE打开,就必须有IDE专有的项目描述文件,使用如下命令可以建立IDEA的工程文件
     mvn idea:idea
     上述命令建立如下三个文件:
         sharequestiont5.ipr
         sharequestiont5.iml     
         sharequestiont5.iws

    使用如下命令可以打开工程:
     open sharequestiont5.ipr

    当然也可以使用Eclipse打开,使用如下命令将建立Eclipse工程文件:
    mvn eclipse:eclipse
    
    使用Eclipse的import功能可以将这个空白项目导入到Eclipse中

2. 使用IDE建立Web应用程序,之后在配置Tapestry库

   2.1 添加如下包的引用,这些包可以从Tapestry官方站点下载的Tapestry 5 的zip文件中找到
  • tapestry-core.jar
  • tapestry-ioc.jar
  • commons-codec.jar
  • tapestry-annotation.jar
  • javassist.jar
  • slf4j-api.jar
  • slf4j-log4j12.jar
  2.2使用如下的web.xml文件
<?xml version="1.0" encoding="UTF-8"?>
<web-app version="2.4"
         
xmlns="http://java.sun.com/xml/ns/j2ee"
         
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         
xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee  http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">

   
<context-param>
       
<param-name>tapestry.app-package</param-name>
       
<param-value>org.myapp.mypackage</param-value>
   
</context-param>
   
<filter>
       
<filter-name>app</filter-name>
       
<filter-class>org.apache.tapestry.TapestryFilter</filter-class>
   
</filter>
   
<filter-mapping>
       
<filter-name>app</filter-name>
       
<url-pattern>/*</url-pattern>
   
</filter-mapping>
</web-app>
   仿照上述的目录位置建立如下的文件(Start.java和Start.html):
public class Start {
   
public String getName() {
     
return "World!"
   
}
}
<html xmlns:t="http://tapestry.apache.org/schema/tapestry_5_0_0.xsd">
<head>
   
<title>Sample App</title>
</head>
<body>
   
<h1> Hello ${name} </h1>
</body>
</html>

   运行你的应用程序.






这篇关于Tapestry 5 Set Up的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!



http://www.chinasem.cn/article/689710

相关文章

poj 3050 dfs + set的妙用

题意: 给一个5x5的矩阵,求由多少个由连续6个元素组成的不一样的字符的个数。 解析: dfs + set去重搞定。 代码: #include <iostream>#include <cstdio>#include <set>#include <cstdlib>#include <algorithm>#include <cstring>#include <cm

Collection List Set Map的区别和联系

Collection List Set Map的区别和联系 这些都代表了Java中的集合,这里主要从其元素是否有序,是否可重复来进行区别记忆,以便恰当地使用,当然还存在同步方面的差异,见上一篇相关文章。 有序否 允许元素重复否 Collection 否 是 List 是 是 Set AbstractSet 否

论文翻译:ICLR-2024 PROVING TEST SET CONTAMINATION IN BLACK BOX LANGUAGE MODELS

PROVING TEST SET CONTAMINATION IN BLACK BOX LANGUAGE MODELS https://openreview.net/forum?id=KS8mIvetg2 验证测试集污染在黑盒语言模型中 文章目录 验证测试集污染在黑盒语言模型中摘要1 引言 摘要 大型语言模型是在大量互联网数据上训练的,这引发了人们的担忧和猜测,即它们可能已

多路转接之select(fd_set介绍,参数详细介绍),实现非阻塞式网络通信

目录 多路转接之select 引入 介绍 fd_set 函数原型 nfds readfds / writefds / exceptfds readfds  总结  fd_set操作接口  timeout timevalue 结构体 传入值 返回值 代码 注意点 -- 调用函数 select的参数填充  获取新连接 注意点 -- 通信时的调用函数 添加新fd到

Android set Tag, findViewWithTag使用

设置了tag为“principal”的view ImageView principal = (ImageView) findViewById(R.id.imagen_home_0);principal.setTag("principal"); 在其它地方获取,获取已经设置了tag为“principal”的view LayoutInflater inflater = LayoutInflate

C++ STL关联容器Set与集合论入门

1. 简介 Set(集合)属于关联式容器,也是STL中最实用的容器,关联式容器依据特定的排序准则,自动为其元素排序。Set集合的底层使用一颗红黑树,其属于一种非线性的数据结构,每一次插入数据都会自动进行排序,注意,不是需要排序时再排序,而是每一次插入数据的时候其都会自动进行排序。因此,Set中的元素总是顺序的。 Set的性质有:数据自动进行排序且数据唯一,是一种集合元素,允许进行数学上的集合相

Eclipse或MyEclipse中Java Working Set管理项目

随着学习JAVA的时间的越来越久,项目也越来越多,Eclipse或MyEclipse界面中显示一堆! 每次工作使用到的项目肯定不会太多...... 每次从这么大数量的工程当中找到自己要使用的, 必须大规模的滚动滚动条...... 图片一   Project Explorer中:    图片二:Package Explorer中: 这样就好找很多了,分类放!

STL set整理

#include<set>#include<cstdio>#include<iterator>#include<iostream>#include<algorithm>using namespace std;//set 集合的操作//multisetset<int>Set1;set<int>Set2;set<int>Set3;/*begin() 返回指向第一个元素的迭代器

解决PHP Warning: strftime(): It is not safe to rely on the system's timezone set

当运行一些程序时,在httpd日志中会有如下警告日志: PHP Warning:  strftime(): It is not safe to rely on the system's timezone settings. You are *required* to use the date.timezone setting or the date_default_timezone_set(

Java中集合类Set、List和Map的区别

Java中的集合包括三大类,它们是Set、List和Map,它们都处于java.util包中,Set、List和Map都是接口,它们有各自的实现类。Set的实现类主要有HashSet和TreeSet,List的实现类主要有ArrayList,Map的实现类主要有HashMap和TreeMap。那么它们有什么区别呢? Set中的对象不按特定方式排序,并且没有重复对象。但它的有些实现类能对集合中的对