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

JSP·ÖÒ³¼¼Êõ

ÔÚʹÓÃÊý¾Ý¿âµÄ¹ý³ÌÖУ¬²»¿É±ÜÃâµÄÐèҪʹÓõ½·ÖÒ³µÄ¹¦ÄÜ£¬¿ÉÊÇJDBCµÄ¹æ·¶¶Ô´ËȴûÓкܺõĽâ¾ö¡£¶ÔÓÚÕâ¸öÐèÇóºÜ¶àÅóÓѶ¼ÓÐ×Ô¼ºµÄ½â¾ö·½°¸£¬±ÈÈçʹÓÃVectorµÈ¼¯ºÏÀàÏȱ£´æÈ¡³öµÄÊý¾ÝÔÙ·ÖÒ³¡£µ«ÕâÖÖ·½·¨µÄ¿ÉÓÃÐԺܲÓëJDBC±¾ÉíµÄ½Ó¿ÚÍêÈ«²»Í¬£¬¶Ô²»Í¬ÀàÐ͵Ä×ֶεÄÖ§³ÖÒ²²»ºÃ¡£ÕâÀïÌṩÁËÒ»ÖÖÓëJDBC¼æÈÝÐԷdz£ºÃµÄ·½°¸¡£
JDBCºÍ·ÖÒ³
¡¡¡¡SunµÄJDBC¹æ·¶µÄÖÆ¶¨£¬ÓÐʱºÜÈÃÈË¿ÞЦ²»µÃ£¬ÔÚJDBC1.0ÖУ¬¶ÔÓÚÒ»¸ö½á¹û¼¯£¨ResultSet£©ÄãÉõÖÁÖ»ÄÜÖ´ÐÐnext()²Ù×÷£¬¶øÎÞ·¨ÈÃÆäÏòºó¹ö¶¯£¬Õâ¾ÍÖ±½Óµ¼ÖÂÔÚÖ»Ö´ÐÐÒ»´ÎSQL²éѯµÄÇé¿öÏÂÎÞ·¨»ñµÃ½á¹û¼¯µÄ´óС¡£ËùÒÔ£¬Èç¹ûÄãʹÓõÄÊÇJDBC1.0µÄÇý¶¯£¬ÄÇôÊǼ¸ºõÎÞ·¨ÊµÏÖ·ÖÒ³µÄ¡£
¡¡¡¡ºÃÔÚSunµÄJDBC2¹æ·¶ÖкܺõÄÃÖ²¹ÁËÕâÒ»¸ö²»×㣬Ôö¼ÓÁ˽á¹û¼¯µÄǰºó¹ö¶¯²Ù×÷£¬ËäÈ»ÈÔÈ»²»ÄÜÖ±½ÓÖ§³Ö·ÖÒ³£¬µ«ÎÒÃÇÒѾ­¿ÉÒÔÔÚÕâ¸ö»ù´¡ÉÏд³ö×Ô¼ºµÄ¿ÉÖ§³Ö·ÖÒ³µÄResultSetÁË¡£
ºÍ¾ßÌåÊý¾Ý¿âÏà¹ØµÄʵÏÖ·½·¨
¡¡¡¡ÓÐһЩÊý¾Ý¿â£¬ÈçMySQL(ºÍPHP´îÅäÖ®×î¼Ñ×éºÏ), Oracle(´óÐÍÍøÕ¾Êý¾Ý¿âƽ̨)µÈÓÐ×Ô¼ºµÄ·ÖÒ³·½·¨£¬±ÈÈçMySQL(ºÍPHP´îÅäÖ®×î¼Ñ×éºÏ)¿ÉÒÔʹÓÃlimit×Ӿ䣬Oracle(´óÐÍÍøÕ¾Êý¾Ý¿âƽ̨)¿ÉÒÔʹÓÃROWNUMÀ´ÏÞÖÆ½á¹û¼¯µÄ´óСºÍÆðʼλÖá£ÕâÀïÒÔMySQL(ºÍPHP´îÅäÖ®×î¼Ñ×éºÏ)ΪÀý£¬ÆäµäÐÍ´úÂëÈçÏ£º
     // ¼ÆËã×ܵļǼÌõÊý
     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;
   }  
¡¡¡¡º


Ïà¹ØÎĵµ£º

JspÔËÐÐÔ­Àí

 
ÐèÒª¼ÇסµÄ֪ʶµã£º
1 ÇëÇóÓ¦´ðģʽ£¬¿Í»§¶Ë·¢ËÍÇëÇ󣬷þÎñÆ÷½øÐÐÏìÓ¦
2 JSPÎļþÊÇÔÚ·þÎñÆ÷¶ËÖ´ÐеÄ
3 ·µ»Ø¸ø¿Í»§¶ËµÄ½á¹ûÊÇJSPÎļþÖ´ÐеĽá¹û£¬²»°üº¬ÈκÎJSPÓï·¨
4 ÄÚ²¿¶ÔÏóÊÇÔÚ°ÑJSPÎļþת»»ÎªJava´úÂëµÄʱºòÉú³ÉµÄ
5 Ö´ÐеIJ¢²»ÊÇJSPÎļþ±¾Éí£¬¶øÊÇJSPת»»³ÉµÄJavaÀàµÄ¶ÔÏóµÄ·½·¨£¬ËùÒÔÓÐʱºòÐÞ¸ÄJSPÎļþ² ......

jsp ÂÒÂëÎÊÌâ

a.jspÒ³ÃæÄÚÈÝ£º
%26lt;%@ page language£½"java" import£½"java.util." pageEncoding£½"GB2312"%%26gt;%26lt;form action£½"b.jsp"%26gt; name£º%26lt;input type£½text name£½name%26gt; %26lt;input type£½submit%26gt;%26lt;/form%26gt;
b.jspÒ³ÃæÄÚÈÝ£º
%26lt;%@ page language£½"java" import£½"java.util." pageE ......

¡¾jsp¡¿jspÒ³Ãæ±í¸ñºÍ±íÍ·µÄÆ´½Ó

 ×öÁËÒ»¸öСģ¿é ÐèÒª ÔÚjspÒ³ÃæÉϰ´ÕÕExcel±¨±í¸ñʽÏÔʾ±íÍ· ËäÈ»²»¸´ÔÓ µ«ÊǵÚÒ»´Î×ö Áô¸ö¼ÍÄî
ÕâЩ¶«Î÷¸ßÊÖµ±È»ÊDz»ÐèÒªÁË µ«ÊǶÔÓÚû×ö¹ýµÄ ¿ÉÄÜ»á¸øÄãÒ»µãµãÊÕ»ñ
ҪעÒâµÄÊÇ ±íÍ·µÄrowspanºÍcolspan ºáÊúҪƥÅä ²»È»ÏÂÃæÔÙÌí¼Ó ±í¸ñ»áÂÒ ÓÐɶ²»Çå³þµÄ »¶Ó­ÁôÑÔ
<%@ page language="java" pageEncoding="UT ......

struts2ÖÐaction»ñÈ¡jspÒ³Ãæ²ÎÊý

ת×Ô£ºhttp://hi.baidu.com/346667002/blog/item/e58edef0d599fcc97831aa18.html
1. ActionContext
ÔÚStruts2¿ª·¢ÖÐ,³ýÁ˽«ÇëÇó²ÎÊý×Ô¶¯ÉèÖõ½ActionµÄ×Ö¶ÎÖÐ,ÎÒÃÇÍùÍùÒ²ÐèÒªÔÚActionÀïÖ±½Ó»ñÈ¡ÇëÇó(Request)»ò»á»°
(Session)µÄһЩÐÅÏ¢,ÉõÖÁÐèÒªÖ±½Ó¶ÔJavaServlet
HttpµÄÇëÇó(HttpServletRequest),ÏìÓ¦(HttpServletRes ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØÍ¼ | ¸ÓICP±¸09004571ºÅ