Introduction to Java + XML + MVC Framework strutscx

Source: Internet
Author: User
Tags xsl xsl file xslt
ArticleDirectory
    • Introduction to Java + XML + MVC Framework strutscx


Introduction to Java + XML + MVC Framework strutscx
Ljdrer original (Participation score: 258, expert score: 460) published: Version: 1.0 read:3789Times

Introduction to Java + XML + MVC Framework strutscx

Strutscx is a Struts-based XML solution framework. Unlike struts, it uses XML (XSLT) as the presentation layer, instead of using JSP as the presentation layer like struts.
The latest version is 0.9.5, which means it is not completely stable and mature, but some of its features are sufficient to meet most of our needs.

According to the instructions on its official website, it has the following features:

    • A lightweight framework that can run on any servlet engine or J2EE application server.
    • Implementation is simple and fast.
    • Supports internationalization.
    • Use pure XML and XSLT solutions to replace struts's JSP and message resource features.
    • Output 100% complies with XML, XHTML, XSL-FO, WML, or other format standards.
    • Error verification is simple.
    • Use JDOM internally.
    • Including fop and support for PDF, SVG, and ASCII output.
    • Including struts validator.
    • Multiple conversions are supported.
    • Supports client XSLT.
    • Contains sample applications (a single war package ).

In terms of its structure, it differs from struts in the response after the action is executed. Struts redirects to JSP after the action is executed, while strutscx redirects to its core class: strutscxservlet, which will find the XSL File Based on the configuration file and automatically generate an XML file with the XSL binding (internally combined with strutscxdocumentbuilder and strutscxtransformer ), some new browsers that support XML (including ie5 and later, Mozilla 1.4 and later) can display the results.
The following two pictures show us the structure of struts and strutscx:

Struts

Strutscx

As for its installation and configuration, its web site (http://it.cappuccinonet.com/strutscx/install.php? Target = install.
Simple Description:
Copy the required jar packages (this project depends on the crystallization of many popular open-source projects, such as avolon, Castor XML, dom4j, fop, Jakarta commons, Jakarta Oro, JDOM, log4j, struts, xerces)
Configure the Web. xml declaration to use strutscxservlet:
<! -- Strutscxservlet -->
<Servlet>
<Servlet-Name> strutscxservlet </servlet-Name>
<Servlet-class> com. cappuccinonet.
Strutscx. XSLT. strutscxservlet </servlet-class>
<Init-param>
<Param-Name> debug </param-Name>
<Param-value> false </param-value>
</Init-param>
<Load-on-startup> 2 </load-on-startup>
</Servlet>
<Servlet-mapping>
<Servlet-Name> strutscxservlet </servlet-Name>
<URL-pattern>/strutscxservlet </url-pattern>
</Servlet-mapping>
Configure the struts-config.xml to use strutscxplugin:
<Plug-in classname ="
Com. cappuccinonet. strutscx. util. strutscxplugin ">
<Set-Property = "Config"
Value = "/WEB-INF/strutscx-config.xml"/>
</Plug-in>
Compile the action. Unlike struts, we need to set the path of the XSL file to be bound in the action:
// Pointer to the strutscx-Definitions
String example file = "Simple. XSL ";
// Set it to the httpservletrequest
Request. setattribute (
Strutscxconstants. cmd_key, cmdfile );

The above is just a very simple introduction. Since the project I am working on is a rewritten project and requires the use of the latest technology, it is possible to support WML in the future, therefore, the solution is to use XML instead of JSP, and this framework can be found now.
Based on our current experience, the main problem may still be about international support, because the solution provided by Alibaba Cloud is different from the common Java-based properties or resources solution, use the XML format defined by it, so it is not very convenient to use.
In terms of development, we need to introduce our development experience and there is nothing in it. As we were not very familiar with the content of the XML file generated at the beginning, therefore, the development steps are as follows:
Configure the strutscx-config.xml file, write the action and formbean, view the content of the generated XML file in debug mode, write the XSL according to the XML content, and finally test whether the XSL file is correct.
It should be noted that we should set debugxml to on in the strutscx-config.xml, And then we add debugxml = true in the URL when calling the action to let it output XML to the browser (such as http: // localhost: 8080/sample/hello. do? Debugxml = true)

Because this framework is still very new, there are not many content about this framework, and there may not be many users, however, I believe that this framework should be widely used under the banner of XML.

:
Http://sourceforge.net/project/showfiles.php? Group_id = 67148 & package_id = 65546 & release_id = 201686

Related Article

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.