欧美一区二区大胆人体摄影专业网站,黄页网站大全在线免费观看,精品无吗乱吗av国产爱色http://www.aygfsteel.com/flustar/category/21699.html態度決定命運,執著成就人生! zh-cnMon, 28 Apr 2008 00:58:54 GMTMon, 28 Apr 2008 00:58:54 GMT60Tomcat設置虛擬路徑和端口http://www.aygfsteel.com/flustar/archive/2007/04/29/114503.htmlflustarflustarSun, 29 Apr 2007 02:19:00 GMThttp://www.aygfsteel.com/flustar/archive/2007/04/29/114503.htmlhttp://www.aygfsteel.com/flustar/comments/114503.htmlhttp://www.aygfsteel.com/flustar/archive/2007/04/29/114503.html#Feedback1http://www.aygfsteel.com/flustar/comments/commentRss/114503.htmlhttp://www.aygfsteel.com/flustar/services/trackbacks/114503.html在server.xml文件中找到<!--   Define a non-SSL HTTP/1.1 Connector on port 8080, change it to 80.   -->
     < Connector
port ="80"                maxHttpHeaderSize ="8192"
               maxThreads ="150"  minSpareThreads ="25"  maxSpareThreads ="75"
               enableLookups ="false"  redirectPort ="8443"  acceptCount ="100"
               connectionTimeout ="20000"  disableUploadTimeout ="true"   />把其中的port改為你想要的端口即可。
二 .設置虛擬路徑
  要在TOMCAT中設置虛擬路徑/abc/,映射到D:\temp中,可以有兩種方法:
1. 在$Tomcat_home$\conf\Catalina\localhost路徑下新建一個XML文件,注意:XML文件的名稱必須和虛擬路徑的名稱相同,本例為abc.xml。內容如下:

<?xml version="1.0" encoding="UTF-8"?>
<Context    docBase="D:\temp"    reloadable="true"    debug="0"/>//此處不用寫" path="/abc",寫不寫效果一樣

這樣就設置好了/abc的虛擬路徑
2.
編輯server文件(%tomcathome%\conf\server.xml)
因為在tomcat啟動時要讀取server文件的信息,所以更改server文件后,一定要重新啟動tomcat。
舉個例子:
我們打算建立一個myjsp的虛擬目錄,只要在%tomcathome%\conf\server.xml文件,在<host>標簽中加入文件中加入如下代碼即可:
<Context path="/myjsp" docBase="c:\myjsp" debug="0" reloadable="true" crossContext="true"></Context>
其中,path為我們要建立的虛擬目錄,docBase為實際目錄在硬盤上的位置。



flustar 2007-04-29 10:19 發表評論
]]>
使用TOMCAT5.5連接池連接mysql(解決Cannot create JDBC driver of class '' for connect URL 'null')http://www.aygfsteel.com/flustar/archive/2007/04/17/111362.htmlflustarflustarTue, 17 Apr 2007 09:27:00 GMThttp://www.aygfsteel.com/flustar/archive/2007/04/17/111362.htmlhttp://www.aygfsteel.com/flustar/comments/111362.htmlhttp://www.aygfsteel.com/flustar/archive/2007/04/17/111362.html#Feedback9http://www.aygfsteel.com/flustar/comments/commentRss/111362.htmlhttp://www.aygfsteel.com/flustar/services/trackbacks/111362.html1)啟動Tomcat服務器,打開瀏覽器,輸入http://localhost:8080/admin(其中localhost是名稱服務器或稱為主機),
進入管理界面的登陸頁面,這時候請輸入原來安裝時要求輸入的用戶名和密碼,登陸到管理界面,

2)選擇Resources-Data sources進入配置數據源界面,選擇
 Data Source Actions ->選擇Create New Data Source,進入配置詳細信息界面
主要內容例如下:
JNDI Name:   ->jdbc/mysql
Data Source URL  ->jdbc:mysql://localhost:3306/test
JDBC Driver Class-> org.gjt.mm.mysql.Driver
3)修改\conf\Catalina\localhost目錄下建立一個xml文件,名稱為你所發布的web應用的名稱.xml,(如testpool.xml)打開添加內容如下:
<?xml version="1.0" encoding="UTF-8"?>
<Context>
 <Resource
      name="jdbc/mysql"
      type="javax.sql.DataSource"
      password="123456"
      driverClassName="org.gjt.mm.mysql.Driver"
      maxIdle="2"
      maxWait="50"
      username="root"
      url="jdbc:mysql://localhost:3306/test"
      maxActive="4"/>

</Context>
內容同conf/server.xml中<GlobalNamingResources>
 <Resource
      name="jdbc/mysql"
      type="javax.sql.DataSource"
      password="123456"
      driverClassName="org.gjt.mm.mysql.Driver"
      maxIdle="2"
      maxWait="50"
      username="root"
      url="jdbc:mysql://localhost:3306/test"
      maxActive="4"/>
  </GlobalNamingResources>

少了這一步會報錯:Cannot create JDBC driver of class '' for connect URL 'null'
4)修改web.xml

打開%TOMCAT_HOME%\conf\web.xml或yourwebapp/web-inf/web.xml,添加以下內容:
    <resource-ref>
    <description>DB Connection</description>
    <res-ref-name>jdbc/mysql</res-ref-name>
    <res-type>javax.sql.DataSource</res-type>
    <res-auth>Container</res-auth>
    </resource-ref>

    注意res-ref-name填寫的內容要與在上文提到的JNDI Name名稱一致。
 到這里,配置工作就基本完成了!

5)引用JNDI時用"java:comp/env/jdbc/mysql";
建立文件測試 test.jsp:
<%@page contentType="text/html;charset=utf-8" %>
<%@page import="java.sql.*" %>
<%@page import="javax.sql.*" %>
<%@page import="javax.naming.*" %>
<html>
<head>
<title>Tomcat連接池測試</title>
</head>
<body>
<%
  Context ctx=new InitialContext();
  Connection conn=null;
  DataSource ds=(DataSource)ctx.lookup("java:comp/env/jdbc/mysql");
  conn=ds.getConnection();
  Statement stmt=conn.createStatement(ResultSet.CONCUR_READ_ONLY,ResultSet.CONCUR_UPDATABLE);
  ResultSet rs=stmt.executeQuery("select * from testexample");
  while(rs.next()){
  out.println(rs.getInt(1));
  out.println(rs.getString(2));
  out.println(rs.getString(3));
  }
  out.println("數據庫操作成功!");
  rs.close();
  stmt.close();
  conn.close();
   
 %>
</body>
</html>




 



flustar 2007-04-17 17:27 發表評論
]]>
主站蜘蛛池模板: 娄底市| 徐水县| 桂东县| 泽普县| 成安县| 太仓市| 永康市| 彭泽县| 平塘县| 闸北区| 定远县| 武隆县| 屏东市| 武安市| 桦甸市| 昌乐县| 潜江市| 万山特区| 武胜县| 洛南县| 中江县| 仁寿县| 平湖市| 天祝| 屏东市| 大理市| 宁津县| 新建县| 隆尧县| 浪卡子县| 隆安县| 无锡市| 疏勒县| 莱芜市| 米脂县| 五河县| 陆河县| 南康市| 平顶山市| 福海县| 三河市|