How to build an XML development environment (2)

Source: Internet
Author: User
Tags add copy html page version xml parser xsl xslt access
Xml

Reloadable= "true" >
</Context>
One of the path-to-your-work-directory is your development directory. Copy the contents of Tomcat's Webapps/xsl-examples directory to your development directory, and start writing your own XML handlers as a reference to this program.

about how to use JSP to do XML development can refer to Sun whitepaper, in: http://java.sun.com/products/jsp/pdf/JSPXML.pdf
That's basically what I told you about this method.


Step 5. Installs an XML Parser.
Having done steps 3 and 4, you have two available XML Parser, which is the Xerces of the xml.apache.org used by the Sun JAXP and XSL Taglib that Tomcat uses. JAXP includes two files Parser.jar and jaxp.jar,xerces only one file Xerces.jar, these files can be found from the Tomcat directory.
It is recommended that you use the Xerecs XML Parser, because it can now support the XML Schema, and it is the open source software. But it's all about personal preference, and Sun's XML Parser is excellent. Decide which XML Parser to use and then add their files to the CLASSPATH. But do not use two XML Parser at the same time. Once the CLASSPATH is in effect, you can use the JDOM and SAX APIs in your Java program to process XML files.

Examples of the applications and usages of JDOM and SAX can be found here: http://developerlife.com


Step 6. Installs a browser that supports XSLT.
This step is not necessary because we can now use XSL Taglib on the Server side to convert the XML file to HTML format and send it to Browser, so you can actually use any browser you like. But installing a browser that supports XSLT can facilitate our learning. Although we now need to do XSLT on the server side, but in the future browsers that support XSLT become popular, we can even skip this step by sending XML and XSL files to the browser. This can greatly reduce the burden on the server side, because doing XSLT is not an easy task.

The use of Mozilla 0.8 is recommended. Speaking of which, you may ask again, why not use IE 4/5? IE 4/5 not also can do XSLT? In addition to my personal preferences, I can cite 3 reasons to use Mozilla:
First, Mozilla supports an XSLT version that is newer than IE 4/5, and the IE 4/5-supported XSLT is not a formal version but a draft. That is: http://www.w3.org/TR/WD-xsl, and Mozilla-supported XSLT is the official version of XSLT. namely: Http://www.w3.org/1999/XSL/Transform.
Second, the XML application in Mozilla includes not only XSLT, but also rdf,xul,svg,mathml and so on, so Mozilla's support for XML goes beyond IE 4/5 in breadth and depth.
The author of the third XML FAQ has added to Mozilla's view that Mozilla's support for XML is much better robust than IE 4/5.

OK, so much, now turn to the point, how to make Mozilla 0.8 support XSLT?
First, download Mozilla 0.8:http://www.mozilla.org/releases/from here
The latest is the 0.8.1 version, but this version does not run after installing the XSLT-enabled module, so it's only going to use the older but slower version 0.8.
If you do not want to have other functions such as SVG/MATHML, the most convenient way is to use a good. exe file installation.
After installation, start Mozilla, visit this page: http://www.mozilla.org/projects/xslt/
There is a Install button on the page, and clicking this button installs the Transformiix module that implements the XSLT function.
Restart Mozilla to access the page mentioned above. Click on the simple example link above. If the results you see are the same as those seen with the click like link, then your Mozilla can already support XSLT.

For more information on how to configure the Mozilla 0.8 support Java Plug-in Please refer to my other post in the XML version: the Mozilla based XML client solution, which is not much to say here.


Step 7. Installs an editor for an XML file.
This step is more than necessary. Have you ever heard of anyone using VI as an HTML page? I have seen this kind of person, that is Yu Mingxian teacher. Lies in the teacher's personal homepage has a kind of eye-catching words: Just vim it! You can actually edit the XML file using any of your favorite editors, but for the convenience of friends who are accustomed to using the WYSIWYG editor, I recommend a few better XML editors:
1. XML Spy: A full-featured XML editor with a trial version to download.
http://www.xmlspy.com/
2. Editml Pro: Another XML editor with a full function comparison.
Http://www.editml.com
3. PSGML for Emacs:emacs, I don't have to say anything, right?
Http://www.lysator.liu.se/projects/about_psgml.html



This is just for the icing on the cake. To introduce some other knowledge, using this knowledge we can build a more powerful development environment.

Step 8. Install a better JSP Framework
It is recommended to use Struts. Struts is a subproject of the Jakarta project to develop a JSP Framework based on the MVC design pattern. The development of Struts can effectively separate the presentation layer and implementation layer of WEB application, and improve the reusability of code. Development based on MVC design pattern is the so-called Model 2 development mode. Currently the project is nearing completion and the latest version is 1.0-beta-1.

about what the MVC design pattern can refer to the book "Design Patterns" of the mechanical industry press. For the use of struts, you can refer to my translation of the Struts User Guide, in the article highlights: http://www.linuxforum.net/doc/strutsuserguide.html

Download Jakarta Struts from here:
http://jakarta.apache.org/builds/jakarta-struts/release/v1.0-b1/
You need to download jakarta-struts-1.0-b1.zip this file.
Unzip it, and then copy the Struts-example.war,struts-documentation.war two files to Tomcat's WebApps directory, and then restart Tomcat. Using Browser access
http://localhost:8080/struts-example/
Run the Mailreader program in the page, if the correct registration can be used.
Struts's documentation is also installed,
http://localhost:8080/struts-documentation/

For information on how to use struts in your own development directory, refer to the documentation that struts brings. There are some discussions about Struts in the Java version, which can be found using the Forum's search function.


Step 9. Establish a connection with Apache
This is already the old growth talk, I introduce the easiest way to use MOD_JK to establish a connection with Apache.
Let's say you've installed Apache, download mod_jk from here:
http://jakarta.apache.org/builds/jakarta-tomcat/release/v3.2.1/bin/win32/i386/
You need to download mod_jk.zip this file.
Unzip it, get a mod_jk.dll, and copy it to the modules directory under the Apache installation directory.
To modify the Apache configuration file httpd.conf, add the following two lines:
Include C:/tomcat/conf/mod_jk.conf-auto
Jkmount/*.do AJP12
where "C:/tomcat" is the Tomcat installation directory.
Add the index.jsp to the DirectoryIndex, namely:
DirectoryIndex index.html index.jsp
If there is a comment before the ServerName, open the comment before ServerName and set it to localhost, that is:
ServerName localhost

Restart Apache to access this page:
http://localhost/examples/
If you can list the JSP and servlet directories, the Tomcat and Apache connections are built.



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.