Talk about Cocoon talk about JSP

zhaozj2021-02-16  50

Old text a year, it seems to have its value today.

Sender: HAX (Hai Yan), News District: WebDevelop

Title: Talk again Cocoon talk about JSP

Sending station: Drinking water Source (June 06, 2002 01:17:17 Thursday), station letters

The famous IBM DW Chinese website has launched a profile tutorial of Cocoon 2, thus once again

The eyes attracted to Cocoon. The following is a personal opinion that I published in the XML discussion area of ​​9CBS,

Paste the raise points.

This tutorial of IBM is very good, highly recommended. BTW, IBM's DW website is much more useful than 9CBS.

About Cocoon, I hope there is a "XSP / COCOON / XML core technology insider", basically

Compiled some basic Cocoon documents with a certain reference value. This is also what I saw.

Domestic unique Cocoon's reference book. But the book is like other domestic books,

It is not more detailed and clear for basic ideas.

Cocoon's original motivation is to achieve three-layer separation of Content-Style-Logic.

A good practice of a web engineer.

Cocoon also derived from previous ServerPages technology (mainly for JSP, of course ASP and

PHP also has the same problem) defect. Although JSP proposes JSP Model 2 to achieve

Model-View-Controller separation, that is, use JavaBean to expressed data (content), use

Servlet controls business logic, using JSP to display logic and performance layers, but still have some practices

The defects are defective. Description of this problem, in October 2000, "JSP Technology -

- is a friend or an enemy? (Http://www-900.ibm.com/developerWorks/cn/

Java / W-Friend / Index.shtml has a detailed discussion.

But if we keep the pace of technology development, we will see this problem due to label library skills.

The maturity of the operation and the birth of the servlet filter mechanism are resolved. Taglib has long been there,

But until JSTL JSP Standard Tag Library is officially released, its power

Really appeared.

From the role task, the programmer is mainly responsible for javabean, servlet, and writing custom standards.

Sign (now you can use JSTL to greatly reduce the burden); designer writing "does not include

JSP of Java Code, actually a mixture of several tags, HTML JSTL custom standard

sign. I think this framework is more suitable for teams mainly based on Java programmers, as well as business

Logical complex application.

Note that as JSP's embedded Java code can realize business logic, JSP Taglib technology,

The same can be used to implement business logic. Of course, using taglib will be better than embedd Java code.

Many, because the code is encapsulated in taglib, so it can be made for small applications

Use JSP without writing servlets. For example, use JSTL's SQL TAG to process data directly

Library (this actually means that there is no or only extremely simple contained in the SQL statement.

Business logic). It is also possible to deal with TAG like , .

Logic, although usually should only be used to process display logic. Of course, these functions will be "

"Some people have destroyed the design principles over the ability to excessive TAGLIB, but for prototype

It is useful to send, test, and lightweight applications! If it is an enterprise application, phase

Letter have the ability to make an enterprise-level programmer, and there will be enough awareness to develop in MVC mode.

Apache's Struts is a good framework based on JSP implementation MVC. It is recommended to be interested.

Comrade Research Research.

Cocoon, expressed data (content) with XML, use XSP (very similar to JSP XML

) Write business logic, implement representation layer (HTML, WML, XML of HTML, WML,) with XSLT

To PDF) and manage it with SiteMap (Cocoon 2). XSP logic single with JSP

Taglib is very similar to the concept to usage, but the implementation method is slightly different. JSP taglib

Including a definition file and implemented TAG class in an XML format, and is compiled; and XSP

Logic orders are running at runtime (of course, cache can be made) to apply XSLT to code

Conversion.

(According to the understanding of my IBM tutorial), in fact, according to the concept of pipeline, from raw data to the most

The final presentation can have any layer, as for how to lay it, the use of each layer, the designer.

This is why cocoon is positioned in the web publishing "framework".

A processing process can be described as: (taken from the IBM tutorial)

Accept request from the user.

Determine the appropriate pipe used to explain the request and generate a response (using a match).

Constructor is constructed from the available pre-configured components.

Indicates that the pipe is a request service.

The response generated by the pipe will return the user, and the results may be cached for the result for later use.

In JSP Model 2, servlet plays the role of "Dispatcher", we use it to control

Task assignment, this is something similar to the pipe. In fact, Cocoon is a big

Servlet. Just the lack of pipeline mechanism before 2.3, only simple

Forward and include, if you need multiple process mechanisms, you have to rely on expansion libraries.

(Such as IBM's WebSphere, or Cocoon. But now servlet has

Other powerful FILTER mechanisms. This makes Cocoon and JSP increasingly combined trends.

However, Cocoon features, in addition to core-cocoon, it also includes

Internal components (including Matchers, Generators, Transformers, Serializer

s, aggregators, etc.), internal logic bill (response, sitemap, xsp, xsp-

Request, Util, XSP-Cookie, LOG, etc.). This way it has a very suitable Web

Published environment. And use JSP, relatively, you need to configure and write parts yourself.

Basic code.

From the role task, the site administrator is responsible for defining sitemap, the programmer is responsible for XSP

Logic orders, designers write XSLT style sheets (including XSLT and target code such as HTML), because

Use XSLT for programmers and designers, in fact, in writing format conversion, just writer

Need to be familiar with how to handle input and output (such as the designer wants to face HTML, programmers should consider

database). In addition, there is an additional role to define the XML used or its

His intermediate format. I think this framework is more suitable for non-Java programmers.

Administrators need to master XSLT as long as they are familiar with XML, programmers and designers; and suitable for business

The logic is relatively simple, focusing on the application of XML data and flexible format conversion requirements. -

※ Source: · Drinking water Source bbs.sjtu.edu.cn · [from: 202.120.15.34]

转载请注明原文地址:https://www.9cbs.com/read-27382.html

New Post(0)