Tutorials to .com

Tutorials to .com » Jsp » Tapestry-hivemind » Wap Application Development Tapestry (Original)

Wap Application Development Tapestry (Original)

Print View , by: iSee ,Total views: 7 ,Word Count: 4433 ,Date: Thu, 16 Apr 2009 Time: 4:42 AM

1 set up the environment
We need the following development environment:
Eclipse3.1 and above: http://www.eclipse.org/downloads/index.php
MyEclipse4.0 and above: http://www.myeclipseide.com (optional)
Java SE 5.0 and above: http://www.sun.com/download/index.jsp
Tomcat 5.5.12 and above Version: http://tomcat.apache.org/download-55.cgi (other web servers can be)
Tapestry4.0 package: http://jakarta.apache.org/site/downloads/downloads_tapestry.cgi
Tapestry4.0 Support Package: http://jakarta.apache.org/tapestry/dependencies.html
Opera browser: http://www.Opera.com
Download after the formation of the above, we can develop our wap procedure.
Eclipse and MyEclipse installation process described in detail I do not, and then we use MyEclipse to create a web project, we have named WapZone, if you are using other Eclipse components also does not matter, create a web project can be common, but Note Tapestry4.0 just downloaded the support package and the package Tapestry4.0 the jar files are copied to the WEB-INF directory, and finally the directory structure as shown below.
And then we configure the web.xml:
xml version = "1.0" encoding = "UTF-8" ?> <? Xml version = "1.0" encoding = "UTF-8"?>
web-app version = "2.4" <Web-app version = "2.4"
    = "http://java.sun.com/xml/ns/j2ee" xmlns = "http://java.sun.com/xml/ns/j2ee"
    = "http://www.w3.org/2001/XMLSchema-instance" xmlns: xsi = "http://www.w3.org/2001/XMLSchema-instance"
    = "http://java.sun.com/xml/ns/j2ee xsi: schemaLocation = "http://java.sun.com/xml/ns/j2ee
> http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd ">
      display-name > Wap Zone </ display-name > <Display-name> Wap Zone </ display-name>
      servlet > <Servlet>
       servlet-name > article </ servlet-name > <Servlet-name> article </ servlet-name>
servlet-class > org.apache.tapestry.ApplicationServlet </ servlet-class > <Servlet-class> org.apache.tapestry.ApplicationServlet </ servlet-class>
      servlet > </ Servlet>
     servlet-mapping > <Servlet-mapping>
        servlet-name > article </ servlet-name > <Servlet-name> article </ servlet-name>
        url-pattern >/ app </ url-pattern > <Url-pattern> / app </ url-pattern>
     servlet-mapping > </ Servlet-mapping>
     mime-mapping > <Mime-mapping>
        extension > wml </ extension > <Extension> wml </ extension>
        mime-type > text/vnd.wap.wml </ mime-type > <Mime-type> text / vnd.wap.wml </ mime-type>
     mime-mapping > </ Mime-mapping>
      mime-mapping > <Mime-mapping>
        extension > wmls </ extension > <Extension> wmls </ extension>
        mime-type > text/vnd.wap.wmlscript </ mime-type > <Mime-type> text / vnd.wap.wmlscript </ mime-type>
    mime-mapping > </ Mime-mapping>
    mime-mapping > <Mime-mapping>
        extension > wbmp </ extension > <Extension> wbmp </ extension>
        mime-type > image/vnd.wap.wbmp </ mime-type > <Mime-type> image / vnd.wap.wbmp </ mime-type>
    mime-mapping > </ Mime-mapping>
     welcome-file-list > <Welcome-file-list>
        welcome-file > index.wml </ welcome-file > <Welcome-file> index.wml </ welcome-file>
    welcome-file-list > </ Welcome-file-list>
web-app > </ Web-app>
servlet,org.apache.tapestry.ApplicationServlet ,/appservlet。 The key here is the configuration of the article's name is a servlet, it is the realization of org.apache.tapestry.ApplicationServlet, and all the / app have to pay the request to deal with this servlet.
Then in the WEB-INF directory create a new xml document, named hivemodule.xml, reads as follows:
xml version = "1.0" encoding = "UTF-8" ?> <? Xml version = "1.0" encoding = "UTF-8"?>
module id = "WapZone" version = "1.0.0" package = "com.wap.zone.view" > <Module id = "WapZone" version = "1.0.0" package = "com.wap.zone.view">
module > </ Module>
moduleid,Hivemind,id,package module。 The id of the module here is only from the role of identity, because hivemind can have a lot of configuration files, so are normally used for package names as id to ensure uniqueness, package ID of the module where the path of the default package. For beginners may not understand this document hivemodule.xml in the end is used to do, in fact, the author of this document is Tepestry another open source project developed by the Hivemind configuration file, applicationContext.xml like spring in the same role . Hivemindspring,,,,,,。 Hivemind open source project this spring is also similar, are the so-called inversion of control framework, it introduced a number of online articles, you can look at themselves, not described in detail here, because I did not know, huh, huh. Well, bet, let's talk then down.
Took over in the WEB-INF directory create article.application, first of all to explain the name of the file name of the file and web.xml file <servlet-name> article </ servlet-name> is relevant, we may have already noted, this document <servlet-name> the name and the value is the same. The contents of the paper is as follows:
<? xml version = "1.0" encoding = "UTF-8"?>
<! DOCTYPE application PUBLIC
"- / / Apache software foundation / / tapestry Specification 4.0 / / EN"
<application name="Wap Zone" engine-class="org.apache.tapestry.wml.WMLEngine">
<meta key="org.apache.tapestry.template-extension" value="wml"/>
<meta key="org.apache.tapestry.page-class-packages" value="com.wap.zone.view.article"/>
<library id="wml" specification-path="/org/apache/tapestry/wml/WML.library"/>
</ application>
  In the application documents, we do the following things:
",engine-class ; First: the name of the statement of the project: name = "Wap Zone", and the definition of the engine-class;
Second: We define the extension template file wml.
Third: We have introduced WML.library.
Fourth: 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 category BasePage    

tapestry & hivemind Articles

Can't Find What You're Looking For?

Rating: Not yet rated


No comments posted.