Tapstry Spring的结合实例

2008-02-23 10:08:31来源:互联网 阅读 ()

新老客户大回馈,云服务器低至5折

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文件

下一篇:Jie Client配置及开发指南