jspÉú³ÉxmlÎļþʾÀý
<£¥@ page contentType="text/html; charset=gb2312" £¥>
<£¥@ page language="java"£¥>
<£¥@ page info="database handler"£¥>
<£¥@ page import="java.io.*"£¥>
<£¥@ page import="java.lang.*"£¥>
<£¥@ page import="java.util.*"£¥>
<£¥@ page import="java.sql.*"£¥>
<£¥@ page import="javax.servlet.*"£¥>
<£¥@ page import="javax.servlet.http.*"£¥>
<html>
<head>
<meta content="text/html; charset=gb2312" http-equiv="content-type">
</head>
<body>
<£¥
int i=0;
String temp=null;
String parCode = request.getParameter("code");
String strSql;
try{
Connection con;
Statement stmt;
ResultSet rs;
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
String url="jdbc:oracle:thin:@192.168.15.248:1521:ycdb";
con=DriverManager.getConnection(url,"webcfcquery","kill859");
//out.println("<center>jdbcÁ¬½ÓOracleÊý¾Ý¿â</center><br><br>");
stmt=con.createStatement();
strSql = "select account_holder,description from account_holder ";
if(parCode!=null)
strSql += " where account_holder='"+ parCode +"'";
rs=stmt.executeQuery(strSql);
FileOutputStream fo=new FileOutputStream("/usr/local/tomcat/webapps/vehicles/treasurer_voucher.xml");
PrintStream so = new PrintStream(fo);
while(rs.next()){
String col1=rs.getString(1);
String col2=rs.getString(2);
try{
if(i==0){
so.println("<?xml version=\"1.0\" encoding=\"gb2312\" ?>");
so.println("<ufinterface roottag=\"voucher\" billtype=\"gl\" subtype=\"\" replace=\"Y\" receiver=\"1051\" sender=\"1101\" isexchange=\"Y\" filename=\"»á¼Æƾ֤.xml\">");
so.println("<voucher id=\"1234560102\">");
// ×¢Ò⣺ÕâÖÖд·¨ÔÚxmlÎļþÏÔʾʱ»á±¨´í£¬²»ÖªµÀΪʲô£¿ so.println("<custcode>"+col1+"</custcode>");
so.print("<custcode>");
if(col2==null) {//Èç¹û²»Åж϶ÔÏócol2ÊÇ·ñΪnullÖµ£¬ÄÇôÔÚ½øÐбàÂëת»»Ê±¿ÉÄÜ»á³öÏÖNullPointerExceptionÒì³£
so.print(col2);
} else {//ÒòΪǰÃæÒѾ¶¨ÒåxmlÎļþµÄ±àÂëÏÔʾ·½Ê½ÊÇgb2312£¬
Ïà¹ØÎĵµ£º
JSP£¨java server page£©
JSPÊÇ·þÎñÆ÷¶ËÔËÐеÄÒ³Ã棬JSP±¾Ê¾ÍÊÇÒ»¸öÎĵµ£¬Ëû²»½ö¿ÉÒÔ°üº¬¾²Ì¬µÄHTML´úÂ룬Ҳ¿ÉÒÔ°üº¬¶¯Ì¬µÄJAVA´úÂ룬·þÎñÆ÷ÈÝÆ÷¿ÉÒÔ½«JSPת»»³ÉServlet·¢²¼£¬²¢½ÓÊÜÇëÇó¡£
JspÎļþÖ»Ðè·ÅÔÚÓ¦ÓÃÎļþϾͿÉÒÔÁË¡£
JSPÀý×Ó£º
<html>
<head& ......
±í½á¹¹£º
CREATE TABLE `article` (
`id` int(10) unsigned ......
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"
layout="vertical"
verticalAlign="middle"
backgroundColor="white" viewSourceURL="srcview/index.html">
<mx:S ......
н¨xmlÎļþµÄÇé¿ö¿ÉÄܲ»¶à£¬µ«¶Ô½Úµã¡¢ÊôÐÔµÄÔöɾ¸Ä²é»áºÜ³£¼û
XmlDocument xmlDoc = new XmlDocument();
xmlDoc.Load(Server.MapPath("data.xml"));
ÕâÁ½¾äÓ¦¸ÃºÜ³£Óõģ¬¼ÓÔØÒѾ´æÔÚµÄxmlÎĵµ¡£
XmlNode root;//¸ù½Úµã
root = xmldoc.DocumentElement;//»ñÈ¡¸ù½ ......
(1)include ÔÚJSP±àÒë³ÉJavaÀàÎļþʱ£¬ÏȽ«includeÎļþÄÚÈݺϲ¢ºó£¬ÔÙ½øÐбàÒë
(2)jsp:include ÔËÐÐʱºÏ²¢,»á½«ÔËÐÐʱµÄ½á¹û°üº¬½øÀ´
(3)c:import ÔËÐÐʱºÏ²¢,»á½«ÔËÐÐʱµÄ½á¹û°üº¬½øÀ´
Òò´Ë£¬
£¨1£©ÀûÓÃinclude°üº¬µÄÒ³ÃæÖÐÈç¹û°üº¬Á˺ÍÔÒ ......