Ò׽ؽØͼÈí¼þ¡¢µ¥Îļþ¡¢Ãâ°²×°¡¢´¿ÂÌÉ«¡¢½ö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;
   }  
¡¡¡¡º


Ïà¹ØÎĵµ£º

Java/JspÅäÖÃ

JAVAÅäÖãº
1£º JAVA_HOME £º  C:\Program Files\Java\jdk1.6.0_12
2£ºCLASSPATH £º    .;%JAVA_HOME%\lib;%JAVA_HOME%\lib\tools.jar
3£ºPATH £º              %JAVA_HOME%\bin;%JAVA_HOME%\jre\bin
TomcatÅäÖ ......

JDKÓëJSPÉèÖÃ

 JDK»·¾³±äÁ¿ÅäÖãº
1.ÓÒ½¡µ¥»÷“ÎҵĵçÄԔͼ±êÑ¡Ôñ“ÊôÐÔ”£¬È»ºóÑ¡Ôñ“¸ß¼¶”Ñ¡Ï
µã»÷“»·¾³±äÁ¿”°´Å¥¡£
2.Ôړϵͳ±äÁ¿”ϵ¥»÷Ñ¡Ôñ“PATH”±äÁ¿£¬È»ºóµã»÷“±à¼­”°´Å¥£»ÔÚ“±äÁ¿Öµ”Ò»À¸µÄ×îÇ°ÃæÌí¼Ó“c:\Java\jd ......

JSP»ñÈ¡ÕæʵIPµØÖ·




 
ÔÚJSPÀ»ñÈ¡¿Í»§¶ËµÄIPµØÖ·µÄ·½·¨ÊÇ£ºrequest.getRemoteAddr£¨£©£¬ÕâÖÖ·½·¨Ôڴ󲿷ÖÇé¿ö϶¼ÊÇÓÐЧµÄ¡£µ«ÊÇÔÚͨ¹ýÁË
Apache£¬SquidµÈ·´Ïò´úÀíÈí¼þ¾Í²»ÄÜ»ñÈ¡µ½¿Í»§¶ËµÄÕæʵIPµØÖ·ÁË¡£Èç¹ûʹÓÃÁË·´Ïò´úÀíÈí¼þ£¬ÓÃ
request.getRemoteAddr£¨£©·½·¨»ñÈ¡µÄIPµØÖ·ÊÇ£º127.0.0.1»ò
192.168.1.110£¬¶ø²¢²»ÊÇ¿ ......

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

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

JSPƬ¶Î

ʹÓÃjspf
ÔÚ¿ª·¢ÖÐдjspÒ³Ãæʱ£¬Í¨³£¶¼ÒªÍ¨¹ýÈçÏ·½Ê½ÔÚjspÎļþÍ·²¿ÒýÈëÎÒÃÇÐèÒªµÄ±êÇ©¿â£¬È磺jspºËÐıêÇ©¿âJSTL£¬Struts ÖеÄ×Ô¶¨Òå±êÇ©£¬Ê±¶ø»¹ÓÐÎÒÃÇ×Ô¼ºÐ´µÄ×Ô¶¨Òå±êÇ©£º
<%@ taglib uri="http://struts.apache.org/tags-html" prefix="html"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefi ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ