Brief Introduction to tapestry

Source: Internet
Author: User

 
Brief Introduction to tapestry:
Tapestry is a servle extension that runs on servlet containers (Tomcat) or servers that contain servlet containers (such as JBoss)
By using tapestry, developers do not need to use JSP technology at all. Users only need to use the template technology provided by tapestry,
Tapestry completely separates view logic from business logic.
 
Tapestry only has two concepts: component or page. Therefore, the link jump target is either a component or a page, and there is no redundant concept of path.
The component name, that is, the object name. The component name and path name are combined into one.
 
 
There are three files: HTML, page, Java; the process should be: HTML ---> page ---> (based on application) Java class
 
Common web design tools or browsers cannot preview components.
 
Component event request: triggers a method in the page class by requesting start. actionlink on a page.
Returns the result and redirects the client to the another page.

 
Currently, there are three components-oriented web presentation layer frameworks: tapestry, JSF, and Wicket.

A) CID attribute: (Java Web component ID) used to specify components in the template.
B) <span> tag: HTML <span> tag is a container that contains text and elements. It cannot display any content,
It is only used as a stylesheet to assist in page display control.
An element in a span row defines a region in the row, that is, a row can be divided into several regions by <span> to achieve a specific effect. <Span> it does not have any attributes.
C) @ MARK: used to indicate an implicit component.
HTML page:
CID: indicates the Java Web component ID of the applied tapestry control. For example, cid = "@ form" indicates that the control is implicitly used.
Implicit controls are the controls directly declared in the page template. The '@' symbol of the CID prefix notifies tapestry that an implicit control is used.
For example, @ form, @ textfield, @ insert, and @ submit are only four of the control libraries provided by the tapestry framework that contain more than 40 controls.
D) asset is used to access static files such as images and stylesheets. For example, <context-asset name = "image1" Path = "images/messageboard/1.gif"/>

Java class in tapestry: defines Dao (database operation class) in page initialization function, executes SQL, returns a list,
Return the list to the page through the set parameter defined by PAGE, and then display it on the page.
The <tr> element in the table is source = "ognl: List". The source parameter can be of the list type or object [] type.
The item in value = "ognl: item" on the page is the name <property-specification name = "item" type = "com. lygedi. wtms. dao. items. wttruckcomp "/>
Type corresponds to the resultclass in the SQL. xml configuration file: Using items, such as com. lygedi. wtms. Dao. Items. wttruckcomp
The SQL statement in XML is read by the wttrucktrailerdaoimp method through ID, and then the Java class calls this method.
Page is a standard page file.
The insert component implements the out. Print () function.
 
In the JWC file:
Allow-Body = "no" indicates that the control does not allow body, and allow-informal-parameters = "yes" indicates that the control allows informal parameters.
<Parameter name = "toolitemdescriptions" type = "Java. util. List" direction = "in" required = "yes"> </parameter>
This indicates that the toolbar control needs to prepare a parameter named toolitemdescriptions. The parameter type is Java. util. List.
If direction is in, this parameter only needs to be input, not output. Required = Yes indicates that this parameter is required and must be provided.
 
First, the template of this control is
<Span serving cid = "$ content $"> </span> indicates that only the content in this region is meaningful and all content outside the region is ignored.

& Copy; ---- copyright information (required by the semicolon)
& Nbsp; --- Space
Bytes ---------------------------------------------------------------------------------------------------------------------------
Custom components:
<1> need an HTML, a jwc, a Java class (Java class is generally org. Apache. tapestry. basecomponent), HTML and JWC placed under the component package in the WEB-INF
<Component-specification class = "org. Apache. tapestry. basecomponent"> indicates the associated Java class in the JWC file.
HTML file write information displayed by yourself
 
<2> On the page where you want to call a component, add <span cid = "@ edicopyright"> </span> ----- implicit component
You do not need the @ symbol, directly <span upload cid = "edicopyright"> </span>, but on the HTML page, you must <component id = "edicopyright" type = "edicopyright"> </component>
<3> be sure to <component-type = "edicopyright" Specification-Path = "component/edicopyright. JWC"/>
After the component is written, you must register it in the namespace.

On the execution process page, a component name is found. If there is @, the JWC path is directly found through application (if there is no @, the type in the page corresponding to the page is found through ID and then in application ),
Find the Java class creation component in the JWC file and output the information of the HTML file.
Bytes -----------------------------------------------------------------------------------------------------
On the page, locate the JWC file by using CID. the Java class decides to create this component, and then go to the HTML file under the same JWC directory.

Component null may not implement the ipage interface. ------------- display-related Java class not inherited from the ipage family

Margin: 0px
 

 
 
 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.