Java + XML + MVC Framework Strutscx Introduction

xiaoxiao2021-03-06  14

Strutscx is a framework based on Struts, unlike Struts, which uses XML (exact XSLT) as a performance layer, rather than Struts as a performance layer as a JSP. It is currently 0.9.5, which means it has not fully stabilized and mature, but some of the features it has now sufficient to meet most of our needs. According to the instructions of its official website, it has the following features: the lightweight framework of any servlet engine or J2EE application server can be run. Simple and fast. Support internationalization. Replace the Struts JSP and Message resource features using pure XML and XSLT solutions. Output 100% complies with XML, XHTML, XSL-FO, WML, or other formatting standards. Error verification is simple. Use JDOM inside. Includes FOP, supports PDF, SVG, and ASCII outputs. Includes Struts Validator. Support multiple conversions. Support client XSLT. Contains example applications (single WAR package). From its structure, it is different from Struts in response after the action is executed, and the strut is turned to the JSP after the action is executed, and the strutscx turns to it is its core class: strutscxservlet, this class will be configured according to configuration File finds the XSL file and automatically generates XML files with XSL binding (in connection with StrutsCXDocumentBuilder and StrutscXTransformer). For some newer support XML browsers (including IE5 or more, Mozilla 1.4 or more) can display results. . The following two pictures allow us to compare the structure of Struts and Strutscx:

Struts

Strutscx

As for its installation and configuration, its website (http://it.cappucinonet.com/strutscx/install.php?target=install) has a comprehensive instruction. Simply described below: Copy the required JAR package (this project relies on many popular open source programs, such as Avolon, Castor XML, DOM4J, FOP, JAKARTA COMMONS, JAKARTA ORO, JDOM, LOG4J, STRUTS, XERCES) Configuring Web .xml declaration uses strutscxservlet:

strutscxservlet

com.cappuccinet.

Strutscx.xslt.strutscxServlet

debug

false

2

strutscxservlet

/ strutscxservlet

Configuring struts-config.xml Use strutscxplugin:

com.cappucinonet.strutscx.util.strutscxplugin>

Value = "/ Web-inf / strutscx-config.xml" />

Writing an action, and Struts, we need to set the path to the XSL file to be bound to the action:

// pointer to the strutscx-definitions

String xslfile = "simple.xsl";

// set it to the httpservletRequest

Request.setttribute

StrutscxConstants.xsl_key, xslfile); The above is just a very simple introduction, because a project that the author is doing is a rewritten project, requiring the latest technology, it is possible to support WML in the future, so the solution is to use XML instead JSP, and currently can find this frame. Based on our current experience, the main problem may still be internationally supported, as it gives an international support program and the currently commonly used Java-based Properties or Resources program, it needs to be used in XML formats. So use is not very convenient. As for development, it is necessary to introduce our development experience. In fact, there is nothing. Since we have just started, we are not very familiar with the contents of the XML files, so we use the development steps as follows: Configure strutscx-config. XML file, write action and formbean, watch the content of the XML file generated in debug mode, write XSL according to XML content, and finally test the XSL file correct. It should be noted that we have to set the debugxml to ON in strutscx-config.xml, and then we add debugxml = true in the URL when calling Action, allowing it to output XML to the browser (for example, http: // localhost: 8080 / Sample / Hello.do? Debugxml = true) Since this framework is still very new, the content of this framework is not much, it may not be a lot of people, but the author believes in the XML's big flag should be very Wide application. Download address: http://sourceforge.net/project/showfiles.php? Group_id = 67148 & package_id = 65546 & release_id = 201686

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

New Post(0)