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

tomcat6.0 + JSP + mysqlÊý¾Ý¿âÁ¬½Ó³ØÅäÖÃ


tomcat6.0 + JSP + mysqlÊý¾Ý¿âÁ¬½Ó³ØÅäÖÃ
»·¾³£ºtomcat6.0 £¬mySQL 5.021
°ÑmysqlÇý¶¯°ü·Ö±ð·Åµ½%TOMCAT_HOME%/lib ºÍÄãµÄÓ¦ÓõÄWEB-INF\libÎļþ¼ÐÏÂÃæ
1¡¢ÐÞ¸Ä%TOMCAT_HOME%/conf/server.xml,Ìí¼ÓÈçÏÂÄÚÈÝ£¨²¿·Ö²ÎÊýÇë±¾µØ»¯£©£º
      <Context path="/web" docBase="web" debug="0"      reloadable="true" crossContext="true">   
 
        <Resource name="jdbc/query"      auth="Container"
type="javax.sql.DataSource" driverClassName="org.gjt.mm.mysql.Driver"
maxIdle="20" maxWait="5000" username="username" password="password"
url="jdbc:mysql://localhost:3306/DataBaseName"      maxActive="100"   
removeAbandoned="true" removeAbandonedTimeout="60"
logAbandoned="true"/>
</Context>
2¡¢Ð޸ĶÔÓ¦Ó¦ÓõÄweb.xml£¬ÔÚ</web-app>Ç°Ìí¼ÓÈçÏÂÄÚÈÝ£º
<ResourceLink name="jdbc/query" global="jdbc/query" type="javax.sql.DataSourcer"/>
ÖØÆôtomcat£¬´ó¹¦¸ã³É£¡
Ó¦ÓÃʵÀýÈçÏ£º
<%@ page contentType="text/html; charset=gb2312" %>
<%@ page import="javax.naming.Context" %>
<%@ page import="javax.sql.DataSource"%>
<%@ page import="javax.naming.InitialContext"%>
<%@ page import="java.sql.*"%>
<html>
<body>
123
<%
        DataSource ds = null;
        try{
          Context initCtx = new InitialContext();
          Context envCtx = (Context) initCtx.lookup("java:comp/env");
        //´ÓContextÖÐlookupÊý¾ÝÔ´¡£
          ds = (DataSource)envCtx.lookup("jdbc/query");
       


Ïà¹ØÎĵµ£º

mySqlÓëWampServerͬʱ°²×°Ê±³öÏÖµÄÎÊÌâ


 
½ñÌìÅöµ½ÕâÑùµÄÒ»¸öÎÊÌ⣺
ÎÒµçÄÔÉÏ°²×°ÁËwampserver£¬È»ºó´ò¿ªphpMyAdmin½øÐÐÊý¾Ý¿â¹ÜÀí²Ù×÷ʱ£¨´´½¨Êý¾Ý¿â£©£¬´´½¨ÍêÖ®ºó£¬µ½wampserver°²×°Ä¿Â¼µÄmysqlĿ¼Ï²鿴¸Õ´´½¨µÄÊý¾Ý¿â¡£¡£¡£ÔõôÕÒҲûÕÒµ½£¬ÎÒ¾ÍÓôÃÆ£¬È»ºó¾ÍÈ¥²éÕÒÎÊÌâµÄÔ­Òò£¬½á¹ûÊÇÕ⣺ÒòΪÎÒµçÄÔÉÏ°²×°WampServer֮ǰÓа²×°¹ýMysql£¬ËùÒÔÖ®ºó¶Ô ......

JSPÒ³ÃæÎÞ·¨½âÎöEL±í´ïʽ

      ×î½üÊÕµ½Ò»¸öÏîÄ¿µÄÔ´´úÂ룬²¿ÊðÒÔºó´ò¿ªÒ³Ãæ·¢ÏÖJSPÒ³ÃæÖеÄEL±í´ïʽ¶¼Ã»ÓнâÎö£¬¶¼ÊÇÔ­ÑùÏÔʾ¡£
ÉÏÍøËÑË÷ÁËÒ»ÏÂÔ­Òò£¬Ô­À´ÊÇServlet°æ±¾µÄÎÊÌâ¡£Ô­À´ServletÖпÉÒÔÉ趨ÊÇ·ñ½âÎöEL±í´ïʽ£¬Ö»ÓÐ2.4°æ±¾µÄServletĬÈÏÊǽâÎöEL±í´ïʽµÄ£¬¶øÆäËû°æ±¾ÊÇĬÈϲ»½âÎöEL±í´ïʽ£¬²éÁËһϳÌÐò£ ......

MySQL COUNT SUM

 select
count(*) as mcount ,
left(create_time,10) as ptime ,
count(if(receive_msg is null,id,null)) as nullcount ,
count(if(receive_msg = '1',receive_msg,null)) as apfcount ,
count(if(receive_msg = '2',receive_msg,null)) as dttcount ,
count(if(receive_msg = '3',receive_ms ......

2010.5.5¼Ç£¨JSPÖÐÒýÓÃjsÎļþ»á·¢ÉúÒýÓò»µ½µÄÎÊÌ⣩

ÔÚJSPÖÐÒýÓÃjsÎļþ»á·¢ÉúÒýÓò»µ½µÄÎÊÌ⣺
    ÔÚwebÏîÄ¿À´æÔÚWEB-INFÎļþĿ¼£¬ÎҵĴíÎó×ö·¨ÊÇ°Ñjs£¬image£¬CSS¶¼·ÅÔÚ´ËÎļþ¼ÐÏ¡£×î³õÒÔΪÊÇÏà¶Ô·¾¶Óë¾ø¶Ô·¾¶¸ã´íÁË£¬µ«ÊÇÔõôÐÞ¸ÄÒ²ÎÞ·¨½â¾öÎÊÌâ¡£µ÷ÓÃjsʱ×ÜÊǻᱨȱÉÙ¶ÔÏó£¬×îºóÁ˽âÊÇÒòΪWEB-INFÕâÀïµÄ¶«Î÷ÊDz»ÈÃÖ±½Ó·ÃÎʵġ£ËùÒԸı䷽·¨°ÑÕâЩΠ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ