锘??xml version="1.0" encoding="utf-8" standalone="yes"?>岛国片av在线,精品国产一区二区国模嫣然,欧美一区二区三区少妇http://www.aygfsteel.com/kevinguan/category/28847.htmlzh-cnThu, 17 Jan 2008 23:49:03 GMTThu, 17 Jan 2008 23:49:03 GMT60- web.xml涓殑listnerhttp://www.aygfsteel.com/kevinguan/articles/175986.htmlKevinGuanKevinGuanThu, 17 Jan 2008 08:24:00 GMThttp://www.aygfsteel.com/kevinguan/articles/175986.htmlhttp://www.aygfsteel.com/kevinguan/comments/175986.htmlhttp://www.aygfsteel.com/kevinguan/articles/175986.html#Feedback0http://www.aygfsteel.com/kevinguan/comments/commentRss/175986.htmlhttp://www.aygfsteel.com/kevinguan/services/trackbacks/175986.html浠婂ぉ紕板埌WEB涓畝鍗曞疄鐜板畾鏃舵墽琛岀▼搴忔椂錛屾兂鍒板浣曞湪涓涓獁ebapp鍚姩鏃舵墽琛岃嚜宸辨兂瑕佺殑涓孌電▼搴忥紝榪欓噷灝辯敤鍒發(fā)istner,榪欓噷鍋氫簡綆鍗曠殑渚嬪瓙
鍒涘緩涓涓被TestContextListner.java瀹炵幇servletContextListner,瀹炵幇contextDestroyed錛宑ontextInitialized涓や釜鏂規(guī)硶錛?br />
1
package com.test;
2
3
import javax.servlet.ServletContextEvent;
4
import javax.servlet.ServletContextListener;
5
6
public class TestContextListener implements ServletContextListener
{
7
public void contextDestroyed(ServletContextEvent arg0)
{
8
System.out.println("destroyed");
9
10
}
11
12
public void contextInitialized(ServletContextEvent arg0)
{
13
System.out.println("test listener initialize++++++++++++++");
14
}
15
}
16
鍦╳eb.xml涓厤緗甽istner
1
<listener>
2
<listener-class>com.test.TestContextListener</listener-class>
3
<description>test listner</description>
4
</listener>
鍚姩tomcat 灝卞彲浠ョ湅鍒?鎵ц浜員estLetenerContext涓殑contextInitialized鏂規(guī)硶浜嗐傝繖鏍峰氨鍙互鑷繁瀹氬埗涓浜涜嚜宸辯殑涓浜涙湇鍔′簡銆?/span>

]]>- Embed Tomcat 寮鍙戯紝璋冭瘯欏圭洰http://www.aygfsteel.com/kevinguan/articles/173998.htmlKevinGuanKevinGuanWed, 09 Jan 2008 06:52:00 GMThttp://www.aygfsteel.com/kevinguan/articles/173998.htmlhttp://www.aygfsteel.com/kevinguan/comments/173998.htmlhttp://www.aygfsteel.com/kevinguan/articles/173998.html#Feedback1http://www.aygfsteel.com/kevinguan/comments/commentRss/173998.htmlhttp://www.aygfsteel.com/kevinguan/services/trackbacks/173998.html紱誨紑鍘熸潵鍏徃宸茬粡鏈変竴孌墊椂闂翠簡錛岀幇鍦ㄥ幓澶栭潰鐨勫叕鍙稿悗錛屽彂鐜板闈㈠熀鏈笂閮界敤鐨勬槸tomcat-plugin 鎴栬呮槸myEclipse涓殑鍚姩錛屽浜庨偅鎻掍歡涓嶆槸寰堢啛鎮(zhèn)夌殑浜猴紝鍙互璇曠潃浣跨敤Embed-tomcat榪涜寮鍙戯紝璋冭瘯銆傝寰楅偅鏄釜涓嶉敊鐨勫紑鍙戠幆澧冿紒
鑷繁鍙互綆鍗曞垱寤轟竴涓獁ebapp鏉ユ惌寤轟竴涓幆澧冿紱
榪欓噷鎴戝緩涓涓」鐩甿ypro錛岀粨鏋勫緢綆鍗曠殑璁劇疆涓涓嬶細(xì)

鍘籥pache涓婂幓涓嬭澆embed-tomcat鐨剒ip鍖咃紝瑙e帇緙╋紝灝哸pache-tomcat-**-embed//lib涓殑jar鍖呭紩鍏ュ埌褰撳墠欏圭洰錛屽湪榪欓噷鎴戝皢鎵鏈夌殑jar鍖呰緗湪user liberay 涓?鍛藉悕涓篍mbed_tomcat 浠ユ柟渚夸嬌鐢紝
鍙﹀web.xml鍒欎負(fù)鏈綆鍗曠殑璁劇疆錛?br />
<?xml version="1.0" encoding="ISO-8859-1"?>
<web-app xmlns="http://java.sun.com/xml/ns/j2ee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee
http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd"
version="2.4">
<welcome-file-list>
<welcome-file>index.jsp</welcome-file>
</welcome-file-list>
</web-app>
鐜板湪浣跨敤java紼嬪簭鍘誨惎鍔╰omcat鏈嶅姟錛屼互涓嬫槸浠g爜錛?/span>
1 import java.net.InetAddress;
2
3 import org.apache.catalina.Context;
4 import org.apache.catalina.Engine;
5 import org.apache.catalina.Host;
6 import org.apache.catalina.connector.Connector;
7 import org.apache.catalina.deploy.ContextResource;
8 import org.apache.catalina.deploy.NamingResources;
9 import org.apache.catalina.startup.Embedded;
10
11 public class EmbededTomcat {
12
13 public static void main(String[] args) throws Exception {
14 Embedded embedded = new Embedded();
15 Engine engine = embedded.createEngine();
16 engine.setDefaultHost("localhost");
17 Host host = embedded.createHost("localhost", "");
18 engine.addChild(host);
19 // Create the ROOT context
20 Context context = embedded
21 .createContext("/test", "D:\\workspace\\mypro\\webapp");
22 /*鏁版嵁婧愰厤緗?br />
23 NamingResources name = new NamingResources();
24 ContextResource resource = new ContextResource();
25 resource.setName("jdbc/jfw");
26 resource.setAuth("Container");
27 resource.setType("javax.sql.DataSource");
28 resource.setProperty("factory",
29 "org.apache.commons.dbcp.BasicDataSourceFactory");
30 resource.setProperty("maxActive", "20");
31 resource.setProperty("maxIdle", "10");
32 resource.setProperty("maxWait", "100000");
33 resource.setProperty("username", "epms");
34 resource.setProperty("password", "nci");
35 resource.setProperty("driverClassName",
36 "oracle.jdbc.driver.OracleDriver");
37 resource.setProperty("url",
38 "jdbc:oracle:thin:@10.147.218.162:1521:pmis2");
39 // resource.setProperty("url",
40 // "jdbc:oracle:thin:@192.168.131.100:1521:epms");
41
42 name.addResource(resource);
43 // System.out.println(resource.getName());
44 // System.out.println(resource.getAuth());
45 // System.out.println(resource.getType());
46 // System.out.println(resource.getProperty("url"));
47 context.setNamingResources(name);
48 */
49 host.addChild(context);
50 embedded.addEngine(engine);
51 Connector connector = embedded.createConnector((InetAddress) null,
52 8080, false);
53 embedded.addConnector(connector);
54 embedded.start();
55 }
56
57 }
58
濡傛灉浣犵殑欏圭洰涓瓨鍦↗NDI鐨勮瘽錛屼互涓婁唬鐮佷腑娉ㄩ噴閮ㄥ垎渚挎槸緇戝畾JNDI鐨勪唬鐮侊紱
榪欎竴孌典唬鐮佺敤XML琛ㄧず 灝辨槸 tomcat 涓殑conf\server.xml,鐢╦ava鎿嶄綔錛?/span>
1 <Server>
2 <Service>
3 <Connector />
4 <Engine>
5 <Host>
6 <Context />
7 </Host>
8 </Engine>
9 </Service>
10 </Server>
鏈鍚庤繍琛孍MBED_TOMCAT.JAVA 灝卞彲浠ュ惎鍔╰omcat浜嗭紒
鍙璁劇疆濂借礬寰?
Context context = embedded.createContext("/test", "D:\\workspace\\mypro\\webapp");
璁﹖omcat 鍚姩鑳藉璇誨彇鍒伴」鐩殑web.xml鍗沖彲銆?br />

]]>
主站蜘蛛池模板:
大余县|
湄潭县|
瑞昌市|
荣成市|
砀山县|
防城港市|
铜陵市|
丽江市|
三河市|
柘城县|
五指山市|
汉中市|
白朗县|
金沙县|
石门县|
吉安县|
卓资县|
武清区|
阿拉尔市|
木里|
广南县|
九江市|
通辽市|
青海省|
永修县|
黄龙县|
伊川县|
屯门区|
钦州市|
区。|
桐城市|
沐川县|
若羌县|
东丰县|
岳阳市|
渝北区|
和政县|
米泉市|
泾川县|
武威市|
奎屯市|