Tapstry Spring的结合实例
2008-02-23 10:08:31来源:互联网 阅读 ()
1. Home.page
==================================================
<?XML version="1.0"?>
<!DOCTYPE page-specification PUBLIC
"-//Apache Software Foundation//Tapestry Specification 3.0//EN"
"http://jakarta.apache.org/tapestry/dtd/Tapestry_3_0.dtd">
<page-specification class="org.apache.tapestry.html.BasePage"/>
====================================================
2.Home.html
====================================================
<html>
<head>
<title>Login</title>
</head>
<body>
<span jwcid="@PageLink" page="Test1">Login</span>
</body>
=============================================================
3.TapestryTest1.application //***.application:*** 一定要和包名相同,否则会出错.
=============================================================
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE application PUBLIC "-//Apache Software Foundation//Tapestry Specification 3.0//EN" "http://jakarta.apache.org/tapestry/dtd/Tapestry_3_0.dtd">
<application name="TapestryTest1" engine-class="test.MyEngine">
<description>add a description</description>
<page name="Home" specification-path="Home.page"/>
</application>
=========================================================
4. applicationContext.xml
=========================================================
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE beans PUBLIC "-//SPRING/DTD BEAN/EN"
"http://www.springframework.org/dtd/spring-beans.dtd">
<beans>
<bean id="helloBean" class="test.HelloBean">
<property name="helloWord">
<value>Hello!Justin!</value>
</property>
</bean>
</beans>
=========================================================
5.Web.xml
==========================================================
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE web-app
PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN" "http://java.sun.com/dtd/web-app_2_3.dtd">
<web-app>
<display-name>TapestryTest1</display-name>
<filter>
<filter-name>redirect</filter-name> <filter-class>org.apache.tapestry.RedirectFilter</filter-class>
</filter>
<filter-mapping>
<filter-name>redirect</filter-name>
<url-pattern>/</url-pattern>
</filter-mapping>
<Servlet>
<servlet-name>TapestryTest1</servlet-name>
<servlet-class>org.apache.tapestry.ApplicationServlet</servlet-class> <load-on-startup>1</load-on-startup>
</servlet>
<servlet>
<servlet-name>context</servlet-name>
<servlet-class> org.springFramework.web.context.ContextLoaderServlet</servlet-class>
<load-on-startup>2</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>TapestryTest1</servlet-name>
<url-pattern>/app</url-pattern>
</servlet-mapping>
</web-app>
==================================================================================
好了.我们现在来做一个测试用例.测试用例的名字为:Test1
6.Test1.html
===========================================================================
<html>
<head>
<title>test1</title>
</head>
<body jwcid="@Body">
TEST1
<hr>
<form jwcid="@Form" method="get" listener="ognl:listeners.clickLinked">name:
<input type="text" jwcid="@TextField" value="ognl:hello.HelloWord" />
<input type="submit"/>
</form>
<hr/>
<span jwcid="@Insert" value="ognl:hello.HelloWord">hello</span>
</body>
</html>
============================================================
7.Test1.page
============================================================
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE page-specification PUBLIC "-//Apache Software Foundation//Tapestry Specification 3.0//EN"
"http://jakarta.apache.org/tapestry/dtd/Tapestry_3_0.dtd">
<page-specification class="test.Test1">
<description>Test1</description>
<property-specification name="hello" type="test.HelloBean">
global.appContext.getBean("helloBean")
</property-specification>
</page-specification>
==========================================================================
8. HelloBean.Java
==========================================================================
package test;
public class HelloBean {
private String word = "Hello!World!";
public void setHelloWord(String word)
{
this.word = word;
}
public String getHelloWord()
标签:
版权申明:本站文章部分自网络,如有侵权,请联系:west999com@outlook.com
特别注意:本站所有转载文章言论不代表本站观点,本站所提供的摄影照片,插画,设计作品,如需使用,请与原作者联系,版权归原作者所有
上一篇:[ant]非常简单的ant文件
IDC资讯: 主机资讯 注册资讯 托管资讯 vps资讯 网站建设
网站运营: 建站经验 策划盈利 搜索优化 网站推广 免费资源
网络编程: Asp.Net编程 Asp编程 Php编程 Xml编程 Access Mssql Mysql 其它
服务器技术: Web服务器 Ftp服务器 Mail服务器 Dns服务器 安全防护
软件技巧: 其它软件 Word Excel Powerpoint Ghost Vista QQ空间 QQ FlashGet 迅雷
网页制作: FrontPages Dreamweaver Javascript css photoshop fireworks Flash