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

Ä¿Ç°×îºÃµÄjsp·ÖÒ³¼¼Êõ£¨×ªÔØ£©

      ÔÚʹÓÃÊý¾Ý¿âµÄ¹ý³ÌÖУ¬²»¿É±ÜÃâµÄÐèҪʹÓõ½·ÖÒ³µÄ¹¦ÄÜ£¬¿ÉÊÇJDBCµÄ¹æ·¶¶Ô´ËȴûÓкܺõĽâ¾ö¡£¶ÔÓÚÕâ¸öÐèÇóºÜ¶àÅóÓѶ¼ÓÐ×Ô¼ºµÄ½â¾ö·½°¸£¬±ÈÈçʹÓÃVectorµÈ¼¯ºÏÀàÏȱ£´æÈ¡³öµÄÊý¾ÝÔÙ·ÖÒ³¡£µ«ÕâÖÖ·½·¨µÄ¿ÉÓÃÐԺܲÓëJDBC±¾ÉíµÄ½Ó¿ÚÍêÈ«²»Í¬£¬¶Ô²»Í¬ÀàÐ͵Ä×ֶεÄÖ§³ÖÒ²²»ºÃ¡£ÕâÀïÌṩÁËÒ»ÖÖÓëJDBC¼æÈÝÐԷdz£ºÃµÄ·½°¸¡£
JDBCºÍ·ÖÒ³
¡¡¡¡SunµÄJDBC¹æ·¶µÄÖƶ¨£¬ÓÐʱºÜÈÃÈË¿ÞЦ²»µÃ£¬ÔÚJDBC1.0ÖУ¬¶ÔÓÚÒ»¸ö½á¹û¼¯£¨ResultSet£©ÄãÉõÖÁÖ»ÄÜÖ´ÐÐnext()²Ù×÷£¬¶øÎÞ·¨ÈÃÆäÏòºó¹ö¶¯£¬Õâ¾ÍÖ±½Óµ¼ÖÂÔÚÖ»Ö´ÐÐÒ»´ÎSQL²éѯµÄÇé¿öÏÂÎÞ·¨»ñµÃ½á¹û¼¯µÄ´óС¡£ËùÒÔ£¬Èç¹ûÄãʹÓõÄÊÇJDBC1.0µÄÇý¶¯£¬ÄÇôÊǼ¸ºõÎÞ·¨ÊµÏÖ·ÖÒ³µÄ¡£
¡¡¡¡ºÃÔÚSunµÄJDBC2¹æ·¶ÖкܺõÄÃÖ²¹ÁËÕâÒ»¸ö²»×㣬Ôö¼ÓÁ˽á¹û¼¯µÄÇ°ºó¹ö¶¯²Ù×÷£¬ËäÈ»ÈÔÈ»²»ÄÜÖ±½ÓÖ§³Ö·ÖÒ³£¬µ«ÎÒÃÇÒѾ­¿ÉÒÔÔÚÕâ¸ö»ù´¡ÉÏд³ö×Ô¼ºµÄ¿ÉÖ§³Ö·ÖÒ³µÄResultSetÁË¡£
ºÍ¾ßÌåÊý¾Ý¿âÏà¹ØµÄʵÏÖ·½·¨
¡¡¡¡ÓÐһЩÊý¾Ý¿â£¬ÈçMysql, OracleµÈÓÐ×Ô¼ºµÄ·ÖÒ³·½·¨£¬±ÈÈçMysql¿ÉÒÔʹÓÃlimit×Ӿ䣬Oracle¿ÉÒÔʹÓÃROWNUMÀ´ÏÞÖƽá¹û¼¯µÄ´óСºÍÆðʼλÖá£ÕâÀïÒÔMysqlΪÀý£¬ÆäµäÐÍ´úÂëÈçÏ£º
// ¼ÆËã×ܵļǼÌõÊý
String SQL = "SELECT Count(*) AS total " + this.QueryPart;
rs = db.executeQuery(SQL);
if (rs.next())
Total = rs.getInt(1);
// ÉèÖõ±Ç°Ò³ÊýºÍ×ÜÒ³Êý
TPages = (int)Math.ceil((double)this.Total/this.MaxLine);
CPages = (int)Math.floor((double)Offset/this.MaxLine+1);
// ¸ù¾ÝÌõ¼þÅжϣ¬È¡³öËùÐè¼Ç¼
if (Total > 0) {
SQL = Query + " LIMIT " + Offset + " , " + MaxLine;
rs = db.executeQuery(SQL);
}
return rs;
}
¸´ÖÆ´úÂë
¡¡¡¡ºÁÎÞÒÉÎÊ£¬Õâ¶Î´úÂëÔÚÊý¾Ý¿âÊÇMysqlʱ½«»áÊÇƯÁÁµÄ£¬µ«ÊÇ×÷Ϊһ¸öͨÓõÄÀࣨÊÂʵÉÏÎÒºóÃæÒªÌṩµÄ¾ÍÊÇÒ»¸öͨÓÃÀà¿âÖеÄÒ»²¿·Ö£©£¬ÐèÒªÊÊÓ¦²»Í¬µÄÊý¾Ý¿â£¬¶ø»ùÓÚÕâ¸öÀࣨ¿â£©µÄÓ¦Óã¬Ò²¿ÉÄÜʹÓò»Í¬µÄÊý¾Ý¿â£¬ËùÒÔ£¬ÎÒÃǽ«²»Ê¹ÓÃÕâÖÖ·½·¨¡£
ÁíÒ»ÖÖ·±ËöµÄʵÏÖ·½·¨
¡¡¡¡ÎÒ¿´¹ýһЩÈ˵Ä×ö·¨£¨ÊÂʵÉÏ°üÀ¨ÎÒÔÚÄÚ£¬Ò»¿ªÊ¼Ò²ÊÇʹÓÃÕâÖÖ·½·¨µÄ£©£¬¼´²»Ê¹ÓÃÈκηâ×°£¬ÔÚÐèÒª·ÖÒ³µÄµØ·½£¬Ö±½Ó²Ù×÷ResultSet¹öµ½ÏàÓ¦µÄλÖã¬ÔÙ¶ÁÈ¡ÏàÓ¦ÊýÁ¿µÄ¼Ç¼¡£ÆäµäÐÍ´úÂëÈçÏ£º
<%
sqlStmt = sqlCon.createStatement(java.sql.ResultSet.TYPE_SCROLL_INSENSITIVE,
java.sql.ResultSet.CONCUR_READ_ONLY);
strSQL = "select name,age fro


Ïà¹ØÎĵµ£º

ÔÚJSPÖÐʹÓÃpager taglib½øÐзÖÒ³´¦Àí

     ÔÚÓ¦ÓóÌÐò¿ª·¢µÄʱºò·ÖÒ³ÓÐÁ½ÖÖ:Õæ·ÖÒ³ºÍ¼Ù·ÖÒ³£¬¼Ù·ÖÒ³Òª°ÑËùÓÐÊý¾ÝÏÈÌáÈ¡³öÀ´·Åµ½Ò»¸ölist¼¯ºÏÀï»òÕß¾²Ì¬±äÁ¿ÖС£Õæ·ÖÒ³ÔòÊÇÐèÒªÓõ½¼¸ÐÐÊý¾ÝÔÙ´ÓÊý¾Ý¿âÖÐÌáÈ¡³öÀ´·Å°ÑÐèÒªÏÔʾµÄÊý¾Ý·Åµ½list¼¯ºÏÀï¡£µ«ÎÞÂÛÕæ·ÖÒ³¼Ù·ÖÒ³pager-taglib¶¼¿ÉÒԺܺõÄΪÎÒÃǽøÐд¦Àí¡£
1.ÏÂÔØpager-taglib
ÏÂÔØµØ ......

MyEclipse¸ü¸Äjsp±à¼­Ê±×ÖÌå

     Ò»Ö±ÒÔÀ´Ê¹ÓÃMyeclipse±à¼­Ê±£¬¸Ð¾õÔ­ÓеÄ×ÖÌå´óСºÜ²»ÊÊÓ¦£¬ÓÚÊÇÔÚÍøÉÏËÑÁ˹ØÓÚÔÚMyEclipseÖÐÔõÑùÐÞ¸Ä×ÖÌå´óС£¬ºÜ¶à¶¼ÊÇʹÓÃwindow-preferences-general-apperaence-colors and fonts-java-java edditor text font À´ÐÞ¸Ä×ÖÌå¡£
    ʹÓÃÕâ¸ö·½·¨ËäȻдÀàÎļþÀïÃæµÄ´óС¶¼¸ü¸ü¸ ......

JSP±à³Ì½ø¶ÈÌõÉè¼ÆʵÀý

Ðí¶àWebÓ¦Óá¢ÆóÒµÓ¦ÓÃÉæ¼°µ½³¤Ê±¼äµÄ²Ù×÷£¬ÀýÈ縴ÔÓµÄÊý¾Ý¿â²éѯ»ò·±ÖصÄXML´¦ÀíµÈ£¬ËäÈ»ÕâЩÈÎÎñÖ÷ÒªÓÉÊý¾Ý¿âϵͳ»òÖмä¼þÍê³É£¬µ«ÈÎÎñÖ´ÐеĽá¹ûÈÔ¾ÉÒª½èÖúJSP²ÅÄÜ·¢Ë͸øÓû§¡£±¾ÎĽéÉÜÁËÒ»ÖÖͨ¹ý¸Ä½øÇ°¶Ë±íÏÖ²ãÀ´¸ÄÉÆÓû§¸Ð¾õ¡¢¼õÇá·þÎñÆ÷¸ºÔصİ취¡£
µ±JSPµ÷ÓÃÒ»¸ö±ØÐ볤ʱ¼äÔËÐеIJÙ×÷£¬ÇҸòÙ×÷µÄ½á¹û²»ÄÜ£¨ÔÚ·þÎñ ......

JSPÖÐÉú³É¶¯Ì¬XMLʵÀý

<?xml version="1.0" encoding="gb2312" ?>
<?xml-stylesheet type="tet/css" href="mystyle.css" ?>
<%@ page errorPage="error.jap" %>
<%@ page contentType="text/xml" %>
<realmarid>
»ÊÂí»¨Ãû²á
<athlete>
<name>Æë´ïÄÚ</name>
<country> ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ