Tutorials to .com

Tutorials to .com » Jsp » Tapestry-hivemind » tapestry environmental structures

tapestry environmental structures

Print View , by: iSee ,Total views: 10 ,Word Count: 2004 ,Date: Thu, 16 Apr 2009 Time: 4:39 AM

We need the following Dongdong:
Eclipse3.1 and above: http://www.eclipse.org/downloads/index.php
MyEclipse4.0 and above: http://www.myeclipseide.com
java SE 5.0 and above: http://www.sun.com/download/index.jsp
Resin3.0.x: http://www.caucho.com/download/index.xtp
Tapestry4.0 package: http://jakarta.apache.org/site/downloads/downloads_tapestry.cgi
Tapestry4.0 Support Package: http://jakarta.apache.org/tapestry/dependencies.html
OK, now we begin to build tapestry project. Configuration for the Eclipse, we will skip the.

Use MyEclipse to create a new Web Project:

We will name the project name MyTapestry4:

Click Finish, we have a new Web Project:

And then we will download a good copy Tapestry4 and support package to the WEB-INF/lib / directory:

And then loading the project file:

And then in the WEB-INF directory create a new xml document, named hivemodule.xml, reads as follows:

  ?> "1.0" encoding = "UTF-8"?>   > "com.tapestry4" version = "1.0.0">  

Here, hivemodule.xml the id in the module with the java package names corresponding com.tapestry4, the id is only since the role of identity, because hivemind can have a lot of configuration files, so are normally used for package names as id to ensure only sexual.

Next, we in the WEB-INF / directory and then create a new application file MyTapestry4.application, which reads as follows:

In the application documents, we do two things:
First: the name of the statement of the project: name = "MyTapestry4";
Second: We have defined the page file and java file corresponding to each path of the default package, Tapestry4 automatically based on this path to find Home.java with the same name Home.page papers, if not, it will default to BasePage category.

And then we configure the web.xml:

In order to test whether the normal configuration, we can do little test:
First of all, we in the src package under the new: com.tapestry4, and then in the package under a new Home.java documents:

   com.tapestry4; package com.tapestry4;    org.apache.tapestry.html.BasePage; import org.apache.tapestry.html.BasePage;    class Home extends  BasePage { public abstract class Home extends BasePage (     String  getTest() { public String getTest () (     "Tapestry!" ; return "Tapestry structures to complete the project!";    )   ) 

In Tapestry4 in, java file can no longer abstract, and the difference compared to the Tapestry3 still very prominent. Because a very simple reason, if the java file Tapestry4 is no longer abstract class, it can be unit tested. At the back, we will see how to unit test.

Then in the WEB-INF / build a next Home.page documents:
package com.tapestry4;

import org.apache.tapestry.html.BasePage;

public abstract class Home extends BasePage (

public String getTest () (
return "Tapestry structures to complete the project!";
)
In the Tapestry4), java file can no longer abstract, and the difference compared to the Tapestry3 still very prominent. Because a very simple reason, if the java file Tapestry4 is no longer abstract class, it can be unit tested. At the back, we will see how to unit test.

Then in the WEB-INF / build a next Home.page documents:


"- / / Apache software foundation / / Tapestry Specification 4.0 / / EN"
"Http://jakarta.apache.org/tapestry/dtd/Tapestry_4_0.dtd">

Finally, we in the web / directory Home.html create a new document:

package com.tapestry4;

import org.apache.tapestry.html.BasePage;

public abstract class Home extends BasePage (

public String getTest () (
return "Tapestry structures to complete the project!";
)
In the Tapestry4), java file can no longer abstract, and the difference compared to the Tapestry3 still very prominent. Because a very simple reason, if the java file Tapestry4 is no longer abstract class, it can be unit tested. At the back, we will see how to unit test.

Then in the WEB-INF / build a next Home.page documents:


"- / / Apache Software Foundation / / Tapestry Specification 4.0 / / EN"
"Http://jakarta.apache.org/tapestry/dtd/Tapestry_4_0.dtd">

Finally, we in the web / directory Home.html create a new document:

<SPAN value = "ognl: test" jwcid = "@ Insert"> <SPAN value = "ognl: test" jwcid = "@ Insert">

The resin extract to your hard disk, of course, the use of tomcat, jetty, etc., can be a way to start the following projects.

First of all, the Eclipse open Window -> Preference:

In the Application Server option MyEclipse, we find Resin3, and then in the right configuration for Resin. First of all designated Resin Server for Enable, and then specify Resin Home Directory Address:

Then we need to ensure that the correct version of JDK, JVM and load two parameters:
-Dorg.apache.tapestry.disable-caching = true
-Dorg.apache.tapestry.enable-reset-service = true
Tapestry3 friends used these two parameters are very familiar with their role in the closure of Tapestry of the page cache, it will be able to let us in the development of projects, html and the page after the modifications do not need to restart the project frequently . However, these two parameters in the load, the more memory consumption, so when released in the project, we no longer had the use of these two parameters.

Once you have correctly configured Resin, we can start Resin in the MyEclipse. First click on MyEclipse configuration management of j2ee projects:

And then in the drop-down menu, select MyTapestry4 our projects, click the Add button on the right:

We have good options to configure Resin Server, and then click Finish:

OK, now we can clearly see that our project has been deployed to the deploy directory Resin was.

Next, we start Resin, we can start our project by:

In the Eclipse console, we can clearly see the entire process of project start:

, OK has. We have built the success of the project, open a browser, enter in the address bar:
http://127.0.0.1:8080/MyTapestry4/app

In fact, the project Tapestry4 structures, is very simple, right?


tapestry & hivemind Articles


Can't Find What You're Looking For?


Rating: Not yet rated

Comments

No comments posted.