JSPÖÐдXMLÎļþ£¬¾Ü¾ø·ÃÎÊ
ÏîÄ¿ÖÐÓиötest.xmlÎļþ
HTML code:
<%@ page language="java" import="org.dom4j.*" pageEncoding="UTF-8"%>
<%@ page import="org.dom4j.io.*"%>
<%@ page import="java.io.*"%>
<html>
<head>
<title>XMLtest</title>
</head>
<body>
<%
Document document = DocumentHelper.createDocument();
//Éú³ÉÒ»¸ö½Óµã
Element root = document.addElement("root"); //Éú³ÉrootµÄÒ»¸ö½Óµã
Element category = root.addElement("category");
//Éú²úcategoryµÄÒ»¸ö½Óµã
Element id = category.addElement("id");
//Éú³ÉidÀïÃæµÄ²ÎÊýÖµ
id.addAttribute("name", "id");
//Éú³ÉidÀïÃæµÄÖµ
id.addText("1");
try{
//¶ÁÈ¡Îļþ
FileWriter fileWriter = new FileWriter("/test.xml");
//ÉèÖÃÎļþ±àÂë
OutputFormat xmlFormat = new OutputFormat();
xmlFormat.setEncoding("GBK");
//´´½¨Ð´Îļþ·½·¨
XMLWriter xmlWriter = new XMLWriter(fileWriter,xmlFormat);
//дÈëÎļþ
xmlWriter.write(document);
//¹Ø±Õ
xm
Ïà¹ØÎÊ´ð£º
txt ºÍXML ¸ñʽÏàÓ¦
²»½èÖúDataSet
µ¼Èë¶ÁÈ¡TXTÎļþ
È»ºóÖ±½ÓдÈëXML(ͬһÎļþ,²»Í¬Êý¾Ý,µÝÔöÔÊý¾ÝûÓб»¸²¸ÇÇé¿öÏÂÔö¼ÓÊý¾Ý.)
½Ì¸öÒªµã»ò×îºÃÊÇÓиö´úÂëÌáʾµÄ
¹ý·ºÃºº °ï¸öæÈö^^
²»»á£¬°ïÂ¥Ö÷ ......
<html><head><title>[@title]</title>
<meta http-equiv=Content-Type content="text/html; charset=gb2312">
<script language='javascript'>
function diyCheck ......
<?xml version="1.0"?>
<root>
<status>433</status>
<msg>Õâ¸öÊǺº×Ö</msg>
<serialno>123</serialno>
</root>
ÈçºÎÓÃASP¶ÁÈ¡ statusÖµ ......
JSPÒ³ÃæÖÐÓжà¸öradio°´Å¥
JSPÒ³Ãæ½«²ÎÊýPOST¸øservlet
ÒªÇóÈçÏÂ;
1.Ñ¡ÔñÒ»¸öradio£¬µ÷ÓÃservlet servletÖиù¾Ý²ÎÊýµ÷ÓÃÆäËû½Ó¿Ú£¬³ý·ÇÑ¡ÖиÃradio²¢µã»÷JSPÖеÄʵР......