Ò׽ؽØͼÈí¼þ¡¢µ¥Îļþ¡¢Ãâ°²×°¡¢´¿ÂÌÉ«¡¢½ö160KB

JavaScript ºÍJSP Á¬½ÓSqlServer Êý¾Ý¿â

µÚÒ»ÖÖ JavaScriptÁ¬½ÓÊý¾Ý¿â£º
<mce:script language="JavaScript"><!--
// ´´½¨Êý¾Ý¿â¶ÔÏó
var objdbConn = new ActiveXObject("ADODB.Connection");
// DSN×Ö·û´®
var strdsn = "Driver={SQL Server};SERVER=192.168.0.210;UID=xhb;PWD=xhb;DATABASE=books";
// ´ò¿ªÊý¾ÝÔ´
objdbConn.Open(strdsn);
// Ö´ÐÐSQLµÄÊý¾Ý¿â²éѯ
var objrs = objdbConn.Execute("SELECT * from book");
// »ñÈ¡×Ö¶ÎÊýÄ¿
var fdCount = objrs.Fields.Count - 1;
// ¼ì²éÊÇ·ñÓмǼ
if (!objrs.EOF){
document.write("<table border=1><tr>");
// ÏÔʾÊý¾Ý¿âµÄ×Ö¶ÎÃû³Æ
for (var i=0; i <= fdCount; i++)
document.write("<td><b>" + objrs.Fields(i).Name + "</b></td>");
document.write("</tr>");
// ÏÔʾÊý¾Ý¿âÄÚÈÝ
while (!objrs.EOF){
document.write("<tr>");
// ÏÔʾÿ±Ê¼Ç¼µÄ×Ö¶Î
for (i=0; i <= fdCount; i++)
document.write("<td valign='top'>" + objrs.Fields(i).Value + "</td>");
document.write("</tr>");
objrs.moveNext(); // ÒƵ½ÏÂÒ»±Ê¼Ç¼
}
document.write("</table>");
}
else
document.write("Êý¾Ý¿âÄÚûÓмǼ!<br>");
objrs.Close(); // ¹Ø±Õ¼Ç¼¼¯ºÏ
objdbConn.Close(); // ¹Ø±ÕÊý¾Ý¿âÁ´½Ó
// --></mce:script>
µÚ¶þÖÖ£ºJSP Á¬½ÓÊý¾Ý¿â
<%@ page contentType="text/html;charset=gb2312"%>
<%@ page import="java.sql.*"%>
<%Class.forName("com.microsoft.jdbc.sqlserver.SQLServerDriver").newInstance();
String
url="jdbc:microsoft:sqlserver://localhost:1433;DatabaseName=pubs";
//pubsΪÄãµÄÊý¾Ý¿âµÄ
String user="sa";
String password="";
Connection conn=
DriverManager.getConnection(url,user,password);
Statement
stmt=conn.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE,ResultSet.CONCUR_UPDATABLE);
String sql="select * from test";
Resul


Ïà¹ØÎĵµ£º

JSPÖж¯Ì¬INCLUDEÓ뾲̬INCLUDEµÄÇø±ð

ÎÒÃǶ¼ÖªµÀÔÚjspÖÐincludeÓÐÁ½ÖÖÐÎʽ,·Ö±ðÊÇ
    <%@ include file=" "%>
    <jsp:include page=" " flush="true"/>
    Ç°ÕßÊÇÖ¸ÁîÔªËØ¡¢ºóÕßÊÇÐÐΪԪËØ.
    ͨ³£µ±Ó¦ÓóÌÐòÖÐËùÓеÄÒ³ÃæµÄijЩ²¿·Ö(ÀýÈç±êÌâ¡¢Ò³½ÅºÍµ¼º½À¸)¶¼ÏàͬµÄʱºò,Î ......

jsp½ûÖ¹Ò³Ã滺´æ

1.½ûÖ¹¿Í»§¶Ë»º´æÒªÔÚ<head>ÖмÓÈëÀàËÆÈçÏÂÄÚÈÝ£º
<META HTTP-EQUIV="pragma" CONTENT="no-cache">
<META HTTP-EQUIV="Cache-Control" CONTENT="no-cache, must-revalidate">
<META HTTP-EQUIV="expires" CONTENT="Wed, 26 Feb 1997 08:21:57 GMT">
2.ÔÚ·þÎñÆ÷µÄ¶¯Ì¬ÍøÒ³ÖнûÖ¹»º´æ£¬Òª¼ÓÈëÀàË ......

JSPÊý¾Ý¿âÁ¬½Ó´óÈ«

JSPÊý¾Ý¿âÁ¬½Ó´óÈ«
2008-07-22 11:47
Ò»¡¢jspÁ¬½ÓOracle8/8i/9iÊý¾Ý¿â£¨ÓÃthinģʽ£©
testoracle.jspÈçÏ£º
< %@ page contentType="text/html;charset=gb2312"% >
< %@ page import="java.sql.*"% >
< html >
< body >
< %Class.forName("oracle.jdbc.driver.OracleDriver").new ......

jspµ÷ÓÃjavabeanʵÀý

goodsbean.java
package sale;
public class goodsbean{
    String Product;
    double Price;
    public goodsbean (){
    this.Product = "box";
    this.Price = 5.0;
    }
public void setProduct (String ......

JSPÒ³ÃæÇ¿ÖƲ»»º´æµÄ·½·¨

ÓеÄÒ³ÃæÐèҪÿ´Îµã»÷½øÈ¥¶¼¶¯Ì¬¸üУ¬¶ø²»ÊǶÁÈ¡»º´æÖеÄÒ³Ãæ¡£
ÔÚJSPÖпÉÒÔÕâÑùʵÏÖ£º
<%
request.setCharacterEncoding("GBK");
response.addDateHeader("Expires",0);
response.setHeader("Pragma","no-cache");
response.setHeader("Cache-Control","no-cache");

%> ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ