|
★☆☆☆☆☆☆☆☆☆ |
积分:285 |
发帖:317 |
登录:2024/3/26 |
注册:2006/6/28 |
|
(1楼)【原创】使用JavaScript编写JSP
<%@ page contentType="text/html;charset=gbk" language="javascript"%><html><head>
<title>JSP 测试</title></head><body>
<%
Class.forName("com.caucho.jdbc.mysql.Driver");
try
{
var ConnStr = "jdbc:mysql_caucho://localhost/Rimifon";
var Conn = java.sql.DriverManager.getConnection(ConnStr, "Rimifon", "******");
var Stm = Conn.createStatement();
var Rs = Stm.executeQuery("select * from Article");
while(Rs.next())
{
out.print("<div>" + GetString(Rs, "BiaoTi") + "</div>");
}
Conn.close();
out.print("连接成功!");
}
catch(err)
{
out.print(err.message);
}
function GetString(Rs, strField)
{
strField = Rs.getString(strField).getBytes("ISO8859_1");
return new java.lang.String(strField, "GBK");
}
%>
</body></html> 目前发现不支持的语法:instanceof
(Resin 2.1.2 + JDK 1.4.2上测试)
|