<% @ 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. *"%>
hEAD>
<%
INT i = 0;
String Temp = NULL;
String Parcode = Request.getParameter ("CODE");
String strsql;
Try {
CONNECTION CON;
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("
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 ("
So.println ("
// Note: This method will be reported in the XML file display, don't know why? So.println ("
So.print ("
If (col2 == null) {// If the object col2 is not a null value, NullPointerException may occur when encoding conversion
So.print (col2);
} else {// Because the encoded display mode that has already defined the XML file is GB2312, it is necessary to convert the string COL2 to the XML before it is necessary to convert to GB2312, which in the XML file can be displayed normally.
Byte [] temp_col = col2.getbytes ("GB2312");
COL2 = New string (TEMP_COL);
So.print (col2);
}
So.println (" CustCode>");
}
} catch (exception e) {
Out.println (E.TOString ());
}
i ;
}
So.println (" voucher>");
So.println (" ufacface>");
So.close ();
} catch (exception e) {
Out.println (e);
}
%>
body>
html>