2020天堂在线亚洲精品专区,亚洲最大视频网站,亚洲伊人成无码综合网 http://www.tkk7.com/dazern/category/7953.html 天之道,利而不害;圣人之道,為而不爭(zhēng);信言不美,美言不信;善者不辯,辯者不善;知者不博,博者不知! zh-cnTue, 27 Feb 2007 12:17:56 GMTTue, 27 Feb 2007 12:17:56 GMT60用eclipse + wtp 開(kāi)發(fā)JSP(轉(zhuǎn)) http://www.tkk7.com/dazern/articles/34434.html夏天的零度夏天的零度Thu, 09 Mar 2006 03:06:00 GMThttp://www.tkk7.com/dazern/articles/34434.htmlhttp://www.tkk7.com/dazern/comments/34434.htmlhttp://www.tkk7.com/dazern/articles/34434.html#Feedback0http://www.tkk7.com/dazern/comments/commentRss/34434.htmlhttp://www.tkk7.com/dazern/services/trackbacks/34434.html作者:explorers
源:
http://blog.csdn.net/explorers/archive/2005/08/15/454769.aspx
      http://www.eclipseworld.org/bbs/read.php?tid=680&fpage=1&toread=&page=1

現(xiàn)在eclipse越來(lái)越好用了,隨著sun jdk5.0的補(bǔ)丁4的推出,eclipse3.1也正式發(fā)布,
二者結(jié)合,速度比以前快了很多。而wtp0.7 m5版本放出也有了一段時(shí)間,這個(gè)月月
底可能wtp0.7會(huì)有release了。現(xiàn)在二者都基本成熟,用eclipse+wtp開(kāi)發(fā)JSP是很方便
的,但是關(guān)于wtp插件的配置和使用方面的文章卻不多。很多人覺(jué)得wtp太麻煩,
配不好不能用,本人一直用wtp開(kāi)發(fā)jsp,常有朋友問(wèn)相關(guān)的問(wèn)題,所以寫(xiě)了這篇文章
用來(lái)介紹WTP的配置和開(kāi)發(fā)JSP的步驟。
  這里介紹的主要是jdk5.0b4 + eclipse3.1 + wtp0.7m5環(huán)境下的配置和開(kāi)發(fā),
其他版本有細(xì)微的差異,但是主要的過(guò)程是相同的。
 
  1. 下載安裝
        這是當(dāng)然的第一步啦,這里是連接:
       
http://www.eclipse.org/webtools/index.html
    2. 配置
有很多項(xiàng)需要配置,羅列如下:
1) 配置java-buildpath

2) 配置JDK
TOMCAT運(yùn)行的時(shí)候需要JDK,eclipse自動(dòng)找到的是jre,如下圖:

3) 配置xml 和 internet 緩存
在web應(yīng)用中通常有很多的xml文件,默認(rèn)情況下wtp會(huì)去驗(yàn)證這些xml文件,
這就需要有這些xml文件的定義dtd或者xsd文件。
wtp默認(rèn)的會(huì)自動(dòng)去下載,下載下來(lái)之后可以緩存之后供以后使用。
所以首先我們要打開(kāi)緩存功能。見(jiàn)下圖,把disable cashing的勾去掉即可。

也可以把常用的xml文件的定義文件配置在xmlcatalog里邊,
這樣進(jìn)行xml驗(yàn)證的時(shí)候會(huì)自動(dòng)使用這些文件,見(jiàn)下圖:

實(shí)在不行,只有把xml自動(dòng)驗(yàn)證去掉了,見(jiàn)Validation選項(xiàng)。
4) 配置tomcat服務(wù)器
現(xiàn)在我們來(lái)配置tomcat,其他服務(wù)器的配置大致相同,如下圖所示:

輸入tomcat的路徑和JDK

3 開(kāi)發(fā)一個(gè)JSP
首先new一個(gè)dynamic web project,在確定之后會(huì)提示是否進(jìn)入j2ee
perspective,選擇否,進(jìn)入java perspective,如下圖:
(說(shuō)明:如果是以前的版本,在new的時(shí)候可能找不到dynamic web
project,而是有一個(gè)Flexible project,那就先建一個(gè)Flexible project,
然后在這個(gè)project下建立就可以找到dynamic web project了!)
注意:第一次運(yùn)行的時(shí)候,由于wtp需要驗(yàn)證web.xml這個(gè)文件,所以
會(huì)去下載web.xml驗(yàn)證要用到的dtd或者xsd,所以速度比較慢,
耐心等待,等所需要的文件全部下載下來(lái)之后以后就ok了。

工程建好之后,在下面創(chuàng)建java class和一個(gè)jsp文件,如下圖,
注意目錄結(jié)構(gòu):

上面圖中的java類(lèi)和jsp都創(chuàng)建好了,現(xiàn)在我們?cè)趖omcat中測(cè)試這個(gè)jsp
頁(yè)面,右擊 webtests這個(gè)項(xiàng)目,在菜單中有一項(xiàng)run on server,點(diǎn)擊
后出來(lái)選擇服務(wù)器的對(duì)話(huà)框,選擇我們建立的tomcat服務(wù)器,然后添加
項(xiàng)目,finish。wtp會(huì)在eclipse內(nèi)打開(kāi)一個(gè)瀏覽器打開(kāi)這個(gè)項(xiàng)目。
  注意到wtp自動(dòng)新建并打開(kāi)的工程servers,這個(gè)工程是在tomcat下
測(cè)試jsp頁(yè)面所必須要有的,而且必須是打開(kāi)的狀態(tài),否則無(wú)法進(jìn)行jsp
測(cè)試。

4. 常見(jiàn)問(wèn)題的解決

1) no server錯(cuò)誤
  這個(gè)錯(cuò)誤在一些版本的wtp里邊,就是一個(gè)紅叉叉的對(duì)話(huà)框,說(shuō)no
server,此時(shí)請(qǐng)確認(rèn)打開(kāi)了servers這個(gè)工程。

2) 類(lèi)未定義錯(cuò)誤
  如果你在web project中使用了一些外部的jar,比如說(shuō)log4j之類(lèi),你
可能在工程的classpath中已經(jīng)添加了這個(gè)jar,但是運(yùn)行時(shí)還會(huì)找不到類(lèi),
這是因?yàn)檫@個(gè)jar沒(méi)有被copy到工程的部署目錄的 WEB-INF/lib目錄下,
顯示 Navigator視圖, 如下圖。".deployables" 是一個(gè)web project
被部署到的地方。把用到的jar 拷貝到lib下即可。
(另一個(gè)解決辦法是把jar拷貝到 /webtests/WebContent/WEB-INF/lib
目錄下,但是這樣做有一個(gè)缺點(diǎn),在你想要查看你用到的包中類(lèi)的源碼
會(huì)比較麻煩。我的做法是把常用的包配置到user library中,設(shè)定好源碼,
再加入到工程的classpath中。如果把jar拷到
/webtests/WebContent/WEB-INF/lib目錄下,那么這個(gè)時(shí)候webtests
這個(gè)工程的classpath中就有兩份同樣的包,在查看源碼的時(shí)候都要選擇,
而且會(huì)以 /WEB-INF/lib下的包為優(yōu)先,這可能跟classpath中的順序有關(guān),
但是不方便。所以直接把jar拷到 .deployables目錄下,可以解決這個(gè)
問(wèn)題。希望以后版本的wtp中能解決這樣的問(wèn)題,如果能夠自動(dòng)的把
classpath中設(shè)置的所有jar都拷到 .deployables目錄下就方便了。)

3) context錯(cuò)誤
  有的時(shí)候會(huì)出現(xiàn)context錯(cuò)誤,大致有兩種,一種是context重復(fù)錯(cuò)誤,
這種情況下,tomcat無(wú)法啟動(dòng)。
  在servers工程里,把server.xml中重復(fù)的context條目手工刪除即可。

另一種錯(cuò)誤是" no context"錯(cuò)誤,這個(gè)時(shí)候tomcat可以啟動(dòng),但是瀏
覽器里邊會(huì)說(shuō)找不到頁(yè)面,這就是說(shuō)server.xml中沒(méi)有這個(gè)context,解決
的辦法是在servers explorer視圖中把server 刪除,然后重新添加這個(gè)web
應(yīng)用,有時(shí)這樣還不能解決可以重新配置server。



夏天的零度 2006-03-09 11:06 發(fā)表評(píng)論
]]>
tomcat 5.5 的The Apache Tomcat Native library which allows optimal performance 的解決 http://www.tkk7.com/dazern/articles/33862.html夏天的零度夏天的零度Mon, 06 Mar 2006 07:38:00 GMThttp://www.tkk7.com/dazern/articles/33862.htmlhttp://www.tkk7.com/dazern/comments/33862.htmlhttp://www.tkk7.com/dazern/articles/33862.html#Feedback2http://www.tkk7.com/dazern/comments/commentRss/33862.htmlhttp://www.tkk7.com/dazern/services/trackbacks/33862.htmlTomcat啟動(dòng)的時(shí)候出現(xiàn)下面這樣的提示:

2006-1-26 19:44:11 org.apache.catalina.core.AprLifecycleListener lifecycleEvent
信息: The Apache Tomcat Native library which allows optimal performance in production environments was not found on the java.library.path: D:\Java\jdk1.5.0_05\bin;.;C:\WINDOWS\system32;C:\WINDOWS;d:\ruby\bin;.;..;D:\Java\jrockit-R26.0.0-jdk

實(shí)際這是建議使用apache的apr。

如果想使用apr的話(huà), 實(shí)際操作很簡(jiǎn)單,

下載 http://tomcat.heanet.ie/native/1.1.1/binaries/win32/tcnative-1.dll

將這個(gè)文件復(fù)制到C:\WINDOWS\system32\下面

然后重新啟動(dòng)tomcat,就會(huì)發(fā)現(xiàn)tomcat 的控制臺(tái)信息為:
2006-1-26 19:48:42 org.apache.coyote.http11.Http11AprProtocol init
信息: Initializing Coyote HTTP/1.1 on http-9080

詳情見(jiàn) http://tomcat.apache.org/tomcat-5.5-doc/apr.html

http://www.google.com/search?hl=zh-CN&newwindow=1&q=The+Apache+Tomcat+Native+library+which+allows+optimal+performance&btnG=%E6%90%9C%E7%B4%A2&lr=




夏天的零度 2006-03-06 15:38 發(fā)表評(píng)論
]]>
Tomcat5.5配置經(jīng)典教程——Configuring & Using Apache Tomcat http://www.tkk7.com/dazern/articles/32826.html夏天的零度夏天的零度Tue, 28 Feb 2006 04:31:00 GMThttp://www.tkk7.com/dazern/articles/32826.htmlhttp://www.tkk7.com/dazern/comments/32826.htmlhttp://www.tkk7.com/dazern/articles/32826.html#Feedback0http://www.tkk7.com/dazern/comments/commentRss/32826.htmlhttp://www.tkk7.com/dazern/services/trackbacks/32826.html                                                 Configuring & Using Apache Tomcat
原文地址:http://www.coreservlets.com/Apache-Tomcat-Tutorial/

                                                               Introduction

CSAJSP
Core Servlets & JSP 2/E
MSAJSP
More Servlets & JSP
Following is a guide to installing and configuring Apache Tomcat 5.5 for use as a standalone Web server (for development) that supports servlets 2.4 and JSP 2.0. (Note: Apache Tomcat is sometimes referred to as "Jakarta Tomcat" since the Apache Java effort is known as "The Jakarta Project"). This Tomcat tutorial covers version 5.5.9; for coverage of older Tomcat versions (Apache Tomcat 5.0.x and Apache Tomcat 4.0.x), please see the Apache Tomcat 5.0 and 4.0 tutorial.

Using Tomcat as a deployment server or integrating Tomcat as a plugin within the regular Apache server or a commercial Web server is more complicated than what is described in this tutorial. Although such integration is valuable for a deployment scenario (see http://jakarta.apache.org/tomcat/tomcat-5.5-doc/), my goal here is to show how to use Tomcat as a development server on your desktop. Regardless of what deployment server you use, you'll want a standalone server on your desktop to use for development.

The examples here assume you are using Windows, but they can be easily adapted for Linux, Solaris, and other versions of Unix. I've gotten many reports of successful use on MacOS X, but don't know the setup details. Except when I refer to specific Windows paths (e.g., C:\blah\blah), I use URL-style forward slashes for path separators (e.g., install_dir/webapps/ROOT). Adapt as necessary.

The information here is adapted from the introductory setup and configuration chapter of Core Servlets and JavaServer Pages, 2nd Edition, Volume 1 from Sun Microsystems Press and Prentice Hall. For the book table of contents, index, source code, etc., please see http://volume1.coreservlets.com/. For information on training courses (either at public venues or on-site at your company) taught by the author of the book and this Apache Tomcat tutorial, please see this servlet, JSP, Struts, JSF, and Java training courses page. To report errors or omissions in this writeup or to inquire about on-site training courses on servlets, JSP, Struts, JSF, and Java, please contact Marty Hall at hall@coreservlets.com.

Executive Summary

JSP, Servlet, Struts, & JSF Training
Looking for hands-on training? Tired of inexperienced instructors teaching someone else's course materials? Want a choice of public or in-house courses? Check out these servlet, JSP, Struts, and JSF training courses.
Distinctive features:
? Personally developed and taught by Marty Hall, an experienced developer, award-winning instructor, 4-time JavaOne speaker, and author of Core Servlets and JSP, More Servlets and JSP, and this Apache Tomcat tutorial.
? A choice of on-site training courses at your organization or training courses at public venues.
? Well-tested, having been used by Marty for courses for more than 100 different organizations in the USA, Canada, Australia, Japan, Puerto Rico, and the Philippines.
I give extremely detailed instructions in the following sections. If you're pretty experienced and just want a short summary, this section will probably be enough for you. You can also download a preconfigured Apache Tomcat version that incorporates all of the modifications of this tutorial and includes a sample development directory, shortcuts, and autoexec.bat file.

  1. Install the JDK. Make sure JDK 1.4 or 1.5 is installed and your PATH is set so that both "java -version" and "javac -help" give a result.
  2. Configure Tomcat.
    1. Download the software. Go to http://jakarta.apache.org/site/binindex.cgi#tomcat and download and unpack the zip file for the current release build of Tomcat 5.5. If you use Tomcat 5.5 with JDK 1.4 (recommended), you have to also download and unpack the "Compat" zip file. Also see the preconfigured Apache Tomcat version.
    2. Set the JAVA_HOME variable. Set it to refer to the base JDK directory, not the bin subdirectory.
    3. Change the port to 80. Edit install_dir/conf/server.xml and change the port attribute of the Connector element from 8080 to 80.
    4. Turn on servlet reloading. Edit install_dir/conf/context.xml and change <Context> to <Context reloadable="true">.
    5. Enable the invoker servlet. Go to install_dir/conf/web.xml and uncomment the servlet and servlet-mapping elements that map the invoker servlet to /servlet/*.
    6. Change the DOS memory settings. If you are on Windows 98/Me and get an "Out of Environment Space" error message when you start the server, right-click on install_dir/bin/startup.bat, select Properties, select Memory, and change the Initial Environment entry from Auto to at least 2816. Repeat the process for install_dir/bin/shutdown.bat. Not necessary on recent version of Windows.
    7. Set the CATALINA_HOME variable. Optionally, set CATALINA_HOME to refer to the top-level Tomcat installation directory. Not necessary unless you copy the startup scripts instead of making shortcuts to them.
    8. Use a preconfigured Tomcat version. Optionally, use a version of Jakarta Tomcat that has all of the above changes already made, and has the test HTML, JSP, and servlet files already bundled.
  3. Test the server.
    1. Verify that you can start the server. Double-click install_dir/bin/startup.bat and try accessing http://localhost/.
    2. Check that you can access your own HTML & JSP pages. Drop some simple HTML and JSP pages into install_dir/webapps/ROOT and access them with http://localhost/filename.
  4. Set up your development environment.
    1. Create a development directory. Put it anywhere except within the Tomcat installation hierarchy.
    2. Make shortcuts to the Tomcat startup & shutdown Scripts. Put shortcuts to install_dir/bin/startup.bat and install_dir/bin/shutdown.bat in your development directory and/or on your desktop.
    3. Set your CLASSPATH. Include the current directory ("."), the servlet/JSP JAR files (install_dir/common/lib/servlet-api.jar and install_dir/common/lib/jsp-api.jar), and your main development directory from Step 1.
    4. Bookmark the servlet & JSP javadocs. Add install_dir/webapps/tomcat-docs/servletapi/index.html and install_dir/webapps/tomcat-docs/jspapi/index.html to your bookmarks/favorites list.
  5. Compile and test some simple servlets.
    1. Test a packageless servlet. Compile a simple servlet, put the .class file in install_dir/webapps/ROOT/WEB-INF/classes, and access it with http://localhost/servlet/ServletName.
    2. Test a servlet that uses packages. Compile the servlet, put the .class file in install_dir/webapps/ROOT/WEB-INF/classes/packageName, and access it with http://localhost/servlet/packageName.ServletName.
    3. Test a servlet that uses packages and utility classes. Compile a servlet, put both the servlet .class file and the utility file .class file in install_dir/webapps/ROOT/WEB-INF/classes/packageName, and access the servlet with http://localhost/servlet/packageName.ServletName. This third step verifies that the CLASSPATH includes the top level of your development directory.
  6. Establish a simplified deployment method.
    1. Copy to a shortcut. Make a shortcut to install_dir/webapps/ROOT. Copy packageless .class files directly there. With packages, copy the entire directory there.
    2. Use the -d option of javac. Use -d to tell Java where the deployment directory is.
    3. Let your IDE take care of deployment. Tell your IDE where the deployment directory is and let it copy the necessary files.
    4. Use ant or a similar tool. Use the Apache make-like tool to automate copying of files.
  7. Get more info. Access the complete set of Tomcat docs, get free JSP and servlet tutorials, read the official servlet and JSP specifications, get JSP-savvy editors and IDEs, look for J2EE jobs, etc.

Install the JDK

Your first step is to download and install Java. The servlet 2.4 (JSP 2.0) specification requires JDK 1.3 or later; J2EE 1.4 (which includes servlets 2.4 and JSP 2.0) requires JDK 1.4 or later. You might as well get a recent Java version, so use JDK 1.4 or 1.5. If you know which of those Java versions will be used on your project, get that one. If not, I recommend JDK 1.4 instead of JDK 1.5 so that you don't limit portability by accidentally using Java 1.5 features in your code. See the following sites for download and installation information.

  • JDK 1.4 for Windows, Linux, and Solaris: http://java.sun.com/j2se/1.4/download.html. Be sure you download the full SDK (Software Development Kit), not just the JRE (Java Runtime Environment). The JRE is only for running already-compiled .class files, and lacks a compiler.
  • JDK 1.5 for Windows, Linux, and Solaris: http://java.sun.com/j2se/1.5.0/download.jsp. Be sure you download the full JDK (J2SE Development Kit), not just the JRE (Java Runtime Environment). The JRE is only for running already-compiled .class files, and lacks a compiler.
  • JDK 1.4 for MacOS: http://developer.apple.com/java/.

Once you've installed Java, confirm that everything including your PATH is configured properly by opening a DOS window and typing "java -version" and "javac -help". You should see a real result both times, not an error message about an unknown command. Or, if you use an IDE, compile and run a simple program to confirm that the IDE knows where you installed Java.

Configure Tomcat

JSP, Servlet, Struts, & JSF Training
Looking for hands-on training? Tired of inexperienced instructors teaching someone else's course materials? Want a choice of public or in-house courses? Check out these servlet, JSP, Struts, and JSF training courses.
Distinctive features:
? Personally developed and taught by Marty Hall, an experienced developer, award-winning instructor, 4-time JavaOne speaker, and author of Core Servlets and JSP, More Servlets and JSP, and this Apache Tomcat tutorial.
? A choice of on-site training courses at your organization or training courses at public venues.
? Well-tested, having been used by Marty for courses for more than 100 different organizations in the USA, Canada, Australia, Japan, Puerto Rico, and the Philippines.
Configuring Tomcat involves five main steps and four optional steps:

  1. Downloading the Jakarta Tomcat software.
  2. Setting the JAVA_HOME variable.
  3. Changing the port from 8080 to 80.
  4. Telling Tomcat to reload servlets when they are modified.
  5. Enabling the invoker servlet
  6. Changing the DOS memory settings. (Win98/Me only)
  7. Setting the CATALINA_HOME variable. (Optional; rarely used)
  8. Using a preconfigured version of Tomcat with these changes already made. (Optional; widely used)
  9. Using the Windows .exe installer instead of the .zip file (Not Recommended)

Details of each step are given below. If Tomcat is already running, restart it after performing these steps.

1. Download the Apache Tomcat Software

Go to http://jakarta.apache.org/site/binindex.cgi#tomcat and download the zip file for the current release build of Jakarta Tomcat 5.5. If you need to use an older version of Tomcat to be compatible with an app server such as BEA WebLogic 8.1 that does not support JSP 2.0, please see the older Apache Tomcat 5.0 and 4.0 tutorial.

Note that if you use Tomcat 5.5 with JDK 1.4 (the recommended setup for most users), you have to download both the main zip file and the "Compat" zip file. If you use Tomcat 5.5 with JDK 1.5, you do not need the "Compat" zip file, but it is better to use JDK 1.4 (unless you will deploy on JDK 1.5 only) so that you do not limit portability by accidentally using JDK 1.5 constructs in your Java code.

Save the zip file(s) on your PC and unzip into a location of your choice. You specify the top-level directory (e.g., C:\) and the zip file has embedded subdirectories (e.g., jakarta-tomcat-5.5.9). Thus, C:\jakarta-tomcat-5.5.9 is a common resultant installation directory. Note: from this point forward, I'll refer to that location as install_dir. For Windows, there is also a .exe installer; I prefer the .zip file, but see the .exe installer section for notes on the differences between the two.

Alternatively, you can use my preconfigured Jakarta Tomcat version. This version already has the port changed to 80, servlet reloading enabled, the invoker servlet turned on, and the "Compat" package included. It also comes with a sample development directory and autoexec.bat file.

2. Set the JAVA_HOME Variable

Next, you must set the JAVA_HOME environment variable to tell Tomcat where to find Java. Failing to properly set this variable prevents Tomcat from compiling JSP pages. This variable should list the base JDK installation directory, not the bin subdirectory. For example, on almost any version of Windows, if you installed the JDK in C:\j2sdk1.4.2_08, you might put the following line in your C:\autoexec.bat file.

  set JAVA_HOME=C:\j2sdk1.4.2_08

On Windows XP, you could also go to the Start menu, select Control Panel, choose System, click on the Advanced tab, press the Environment Variables button at the bottom, and enter the JAVA_HOME variable and value directly. On Windows 2000 and NT, you do Start, Settings, Control Panel, System, then Environment. However, you can use C:\autoexec.bat on those versions of Windows also (unless a system administrator has set your PC to ignore it).

3. Change the Port to 80

Assuming you have no other server already running on port 80, you'll find it convenient to configure Tomcat to run on the default HTTP port (80) instead of the out-of-the-box port of 8080. Making this change lets you use URLs of the form http://localhost/blah instead of http://localhost:8080/blah. Note that you need admin privileges to make this change on Unix/Linux. Also note that some versions of Windows XP automatically start IIS on port 80. So, if you use XP and want to use port 80 for Tomcat, you may need to disable IIS (see the Administrative Tools section of the Control Panel).

To change the port, edit install_dir/conf/server.xml and change the port attribute of the Connector element from 8080 to 80, yielding a result similar to that below.

    <Connector port="80" ...
      maxThreads="150" minSpareThreads="25" ...

You can also:

4. Turn on Servlet Reloading

The next step is to tell Tomcat to check the modification dates of the class files of requested servlets, and reload ones that have changed since they were loaded into the server's memory. This slightly degrades performance in deployment situations, so is turned off by default. However, if you fail to turn it on for your development server, you'll have to restart the server every time you recompile a servlet that has already been loaded into the server's memory. Since this tutorial discusses the use of Tomcat for development, this change is strongly recommended.

To turn on servlet reloading, edit Edit install_dir/conf/context.xml and change

  <Context>

to

  <Context reloadable="true">

You can also:

5. Enable the Invoker Servlet

The invoker servlet lets you run servlets without first making changes to your Web application's deployment descriptor (i.e., the WEB-INF/web.xml file). Instead, you just drop your servlet into WEB-INF/classes and use the URL http://host/servlet/ServletName (or http://host/webAppName/servlet/ServletName once you start using your own Web applications; see Section 2.11 of the book for details on Web apps). The invoker servlet is extremely convenient when you are learning and even when you are doing your initial development. You almost certainly want to enable it when learning, but you should disable it again before deploying any real applications.

To enable the invoker servlet, uncomment the following servlet and servlet-mapping elements in install_dir/conf/web.xml. Do not confuse this Apache Tomcat-specific web.xml file with the standard one that goes in the WEB-INF directory of each Web application.

    <servlet>
        <servlet-name>invoker</servlet-name>
        <servlet-class>
          org.apache.catalina.servlets.InvokerServlet
        </servlet-class>
        ...
    </servlet>
    ...
    <servlet-mapping>
        <servlet-name>invoker</servlet-name>
        <url-pattern>/servlet/*</url-pattern>
    </servlet-mapping>

You can also:

6. Change DOS Memory Settings (Win 98/Me Only)

If you use Windows 98/Me, you may also have to change the DOS memory settings for the startup and shutdown scripts. If you get an "Out of Environment Space" error message when you start the server, you will need to right-click on install_dir/bin/startup.bat, select Properties, select Memory, and change the Initial Environment entry from Auto to at least 2816. Repeat the process for install_dir/bin/shutdown.bat. This step is not necessary in more recent versions of Windows.

7. Set the CATALINA_HOME Variable (Optional)

If you are going to make copies of the Tomcat startup or shutdown scripts (e.g., startup.bat and shutdown.bat), it is also helpful to set the CATALINA_HOME environment variable to refer to the top-level directory of the Apache Tomcat installation (e.g., C:\jakarta-tomcat-5.5.9<%2

夏天的零度 2006-02-28 12:31 發(fā)表評(píng)論
]]>
Tomcat 5.5.15相關(guān)配置 http://www.tkk7.com/dazern/articles/32776.html夏天的零度夏天的零度Tue, 28 Feb 2006 00:51:00 GMThttp://www.tkk7.com/dazern/articles/32776.htmlhttp://www.tkk7.com/dazern/comments/32776.htmlhttp://www.tkk7.com/dazern/articles/32776.html#Feedback0http://www.tkk7.com/dazern/comments/commentRss/32776.htmlhttp://www.tkk7.com/dazern/services/trackbacks/32776.html 作者: hasek   發(fā)表日期: 2006-02-21 00:08   復(fù)制鏈接

     Tomcat作為一個(gè)很優(yōu)秀的web application server的確值得大家使用,特別是熟悉java的愛(ài)好者,不過(guò)它的配置并不象它的應(yīng)用那么優(yōu)秀,至少在配置上有很多瑣碎的事情要做,現(xiàn)在我將我自己配置最新的tomcat5.5.15的一點(diǎn)心得告訴大家:

總共涉及三個(gè)方面,也是tomcat配置比較煩瑣的地方

一.與apache的配置(暫略,晚點(diǎn)再將配置詳細(xì)介紹)

二.使tomcat5.5.15支持jstl標(biāo)簽
    這個(gè)是最簡(jiǎn)單的配置,只要按照以下方法,就可以配置成功.
    1.下載 jakarta-taglibs-standard-1.1.2.zip (windows)
              jakarta-taglibs-standard-1.1.2.tar.gz(linux)
    2.解壓在解壓的lib目錄下找到j(luò)stl.jar,standard.jar這兩個(gè).jar文件,將他們復(fù)制到 你的站點(diǎn)/WEB-INF/lib文件夾下,在tld目錄下將所有的.tld文件復(fù)制到 你的站點(diǎn)/WEB-INF/taglib/文件下
    3.配置 你的站點(diǎn)/WEB-INF/web.xml文件,在</webapp>前添加如下內(nèi)容
  <taglib>
  <taglib-uri>http://www.hnlinux.net/core</taglib-uri>
  <taglib-location>/WEB-INF/taglibs/c.tld</taglib-location>
  </taglib>

  <taglib>
  <taglib-uri>http://www.hnlinux.net/fn</taglib-uri>
  <taglib-location>/WEB-INF/taglibs/fn.tld</taglib-location>
  </taglib>

  <taglib>
  <taglib-uri>http://www.hnlinux.net/sql</taglib-uri>
  <taglib-location>/WEB-INF/taglibs/sql.tld</taglib-location>
  </taglib>

  <taglib>
  <taglib-uri>http://www.hnlinux.net/fmt</taglib-uri>
  <taglib-location>/WEB-INF/taglibs/fmt.tld</taglib-location>
  </taglib>
(注意我的<taglib-uri>引用了http://www.hnlinux.net,呵呵,所以大家如果按照這樣設(shè)置的話(huà),在jsp中引用jstl標(biāo)簽是記得采用這樣寫(xiě)<%@ taglib uri=http://www.hnlinux.net/core prefix="c" %>,可見(jiàn)這里配置是很靈活的隨便你取什么名字,只要在寫(xiě)jsp的時(shí)候相對(duì)應(yīng)就可以)

現(xiàn)在你就可以使用jstl來(lái)書(shū)寫(xiě)你的jsp了.

三.連接mysql數(shù)據(jù)庫(kù)的配置
   1.下載 mysql-connector-java-5.0.0-beta.zip 將mysql-connector-java-5.0.0-beta-bin.jar復(fù)制到$Tomcat_home$/common/lib文件夾,(如果你不想使用數(shù)據(jù)連接池的話(huà),可以放在 你的站點(diǎn)/WEB-INF/lib文件夾下)
 2.搞定了,你現(xiàn)在就可以使用連接數(shù)據(jù)庫(kù)的的相關(guān)語(yǔ)句了(這個(gè)是最簡(jiǎn)單的,呵呵)

四.mysql連接池的配置.
 1.下載commons-dbcp-1.2.1.zip 解壓將commons-dbcp-1.2.1.jar復(fù)制到$Tomcat_home$/common/lib下(保證mysql的jdbc的驅(qū)動(dòng)也在此目錄)
 2.修改$Tomcat_home$/cof/server.xml在context標(biāo)簽內(nèi)添加以下內(nèi)容,如果沒(méi)有找到context標(biāo)簽,注意在下面加上紅色的部分,蘭色部分根據(jù)自己情況修改,不用解釋了吧?
<Context path="/hasek" docBase="hasek"
        debug="5" reloadable="true" crossContext="true">
  <Resource name="hasek" auth="Container" type="javax.sql.DataSource"
               maxActive="100" maxIdle="30" maxWait="10000"
               username="root" password="root" driverClassName="com.mysql.jdbc.Driver"
               url="jdbc:mysql://localhost:3306/hasek?autoReconnect=true"/>

</Context>
注意一點(diǎn)的事情是:<Context path="/hasek" docBase="hasek"... 中/hasek代表的是 你的站點(diǎn)
<Resource name="hasek
" 這個(gè)hasek代表的是你的連接池的名字,這個(gè)要和下面的web.xml里的內(nèi)容相一致.
url="jdbc:mysql://localhost:3306/hasek?autoReconnect=true"/>中的hasek代表你的數(shù)據(jù)庫(kù)名字

3.修改 你的站點(diǎn)/WEB-INF/web.xml 在</webapp>標(biāo)簽前添加以下內(nèi)容:

  <description>MySQL Test App</description>
  <resource-ref>
      <description>DB Connection</description>
      <res-ref-name>hasek</res-ref-name>
      <res-type>javax.sql.DataSource</res-type>
      <res-auth>Container</res-auth>
  </resource-ref>
 4.測(cè)試代碼(連接池與jstl標(biāo)簽測(cè)試)test.jsp

<%@ taglib uri="http://www.hnlinux.net/sql" prefix="sql" %>
<%@ taglib uri="http://www.hnlinux.net/core" prefix="c" %>

<sql:query var="rs" dataSource="hasek">
select * from hasek
</sql:query>

<html>
  <head>
    <title>DB Test</title>
  </head>
  <body>

  <h2>測(cè)試成功</h2>
 
<c:forEach var="row" items="${rs.rows}">
    Foo ${row.id}<br/>
    Bar ${row.num}<br/>
</c:forEach>

  </body>
</html>
5.輸入http://localhost:8080/hasek/test.jsp看到測(cè)試成功字樣就說(shuō)明你配置ok了



]]>
[轉(zhuǎn)載]Tomcat 5.5.15 和SQLServer2000 SP3的連接池http://www.tkk7.com/dazern/articles/32727.html夏天的零度夏天的零度Mon, 27 Feb 2006 12:44:00 GMThttp://www.tkk7.com/dazern/articles/32727.htmlhttp://www.tkk7.com/dazern/comments/32727.htmlhttp://www.tkk7.com/dazern/articles/32727.html#Feedback0http://www.tkk7.com/dazern/comments/commentRss/32727.htmlhttp://www.tkk7.com/dazern/services/trackbacks/32727.htmlTomcat 5.5.15 和SQLServer2000 SP3基于SQLServer2000JDBC SP3 的連接池配制
一、準(zhǔn)備
需要下載:
1. tomcat5.5.15
2. Tomcat5.5.15admin
3. SQLServer2000JDBC SP3或者jtds

安裝tomcat。并添加admin角色和用戶(hù)。
將jdbc驅(qū)動(dòng)包放到tomcat_home\common\lib目錄下。
在MyEclipse建立一個(gè)新的Web項(xiàng)目。使用剛才配置的tomcat作為服務(wù)器。

啟動(dòng)tomcat。

二、配置
打開(kāi)tomcat。
 
登錄 Tomcat Web Server Administration Tool.


點(diǎn)擊左側(cè)的Data Sources。
 
在右側(cè)Available Actions下拉菜單中選擇Create New Data Source.
 
輸入
JNDI Name:
Data Source URL:
JDBC Driver Class:
User Name:
Password:
Max.Active Connections:最大活動(dòng)連結(jié)數(shù) ,0為不限 。
Max.Idle Connections:最大等待連結(jié)數(shù) ,0為不限 。
Max.Wait for Connection:建立連接超時(shí)時(shí)間ms,-1為無(wú)限 。

注:使用SQLServer的官方JDBC驅(qū)動(dòng),Class=com.microsoft.jdbc.sqlserver.SQLServerDriver,URL=jdbc:Microsoft:sqlserver://127.0.0.1:1433;databaseName=aa;使用開(kāi)源的驅(qū)動(dòng)Jtds,Class=net.sourceforge.jtds.jdbc.sqlserver,URL=jdbc:jtds:sqlserver://127.0.0.1:1433/aa

輸入完畢,點(diǎn)擊“Save”按鈕保存。
 
點(diǎn)擊頁(yè)面右上側(cè)“Commit Changes”按鈕,保存剛才的設(shè)置。(這一步很重要哦!)

打開(kāi)tomcat_home\conf\server.xml的< GlobalNamingResources></ GlobalNamingResources>中找到

    <Resource
      name="jdbc/mydbcp"
      type="javax.sql.DataSource"
      password="aa"
      driverClassName="com.microsoft.jdbc.sqlserver.SQLServerDriver"
      maxIdle="2"
      maxWait="5000"
      username="aa"
      url="jdbc:microsoft:sqlserver://10.0.2.37:1433;databaseName=aa"
      maxActive="4"/>
這是JNDI的主要配置文件,可以不使用圖形界面直接寫(xiě)入server.xml中。
在tomcat_home\webapps\dbcp\ META-INF\context.xml的<context></context>中填入上面的代碼。
如果更改了JNDI,則必須手動(dòng)更改context.xml。

    <Resource
      name="mydbcp" 注:此處不同
      type="javax.sql.DataSource"
      password="aa"
      driverClassName="com.microsoft.jdbc.sqlserver.SQLServerDriver"
      maxIdle="2"
      maxWait="5000"
      username="aa"
      url="jdbc:microsoft:sqlserver://10.0.2.37:1433;databaseName=aa"
      maxActive="4"/>

  <ResourceLink
    global="jdbc/mydbcp"
    name="jdbc/mydbcp"
type="javax.sql.DataSource"/>

重起tomcat。

連接方法:

    Context initCtx = new InitialContext();
    Context envCtx = (Context) initCtx.lookup("java:comp/env");
    DataSource ds = (DataSource) envCtx.lookup("jdbc/mydbcp");
    Connection conn = ds.getConnection();
    Statement stmt = conn.createStatement();
    ResultSet rs = stmt.executeQuery("select * from systypes");
三、測(cè)試

測(cè)試實(shí)例:test.jsp

<%@ page language="java" pageEncoding="UTF-8"%>
<%@ page contentType="text/html; charset=UTF-8"%>
<%@ page import="java.sql.*,javax.sql.DataSource,javax.naming.*"%>
<html>
 <head>
  <title>
   tomcat 連接池
  </title>
 </head>
 <body bgcolor="#ffffff">
  <h3>
   test
   <br>
   連接池3
  </h3>
  <%try {
    Context initCtx = new InitialContext();
    Context envCtx = (Context) initCtx.lookup("java:comp/env");
    DataSource ds = (DataSource) envCtx.lookup("jdbc/mydbcp");
    Connection conn = ds.getConnection();
    Statement stmt = conn.createStatement();
    ResultSet rs = stmt.executeQuery("select * from systypes");
    while (rs.next()) {%>

  <br>
  <%=rs.getString(1)%>
  <%}%>
  <%out.print("<br>Successful!成功!!\n");%>
  <%rs.close();
    stmt.close();
    conn.close();
   } catch (Exception e) {
    out.print("出現(xiàn)例外!" + e.getMessage());
    e.printStackTrace();
   }

  %>

 </body>
</html>

四、錯(cuò)誤

錯(cuò)誤1:Cannot load JDBC driver class 'com.microsoft.jdbc.sqlserver.SQLServerDriver'
是沒(méi)有將sql jdbc driver包放在common\lib\目錄下。

錯(cuò)誤2:Cannot create PoolableConnectionFactory ([Microsoft][SQLServer 2000 Driver for JDBC]Error establishing socket.)
SQL數(shù)據(jù)庫(kù)補(bǔ)丁包的問(wèn)題,如果訪問(wèn)的數(shù)據(jù)庫(kù)是SP3,任何問(wèn)題沒(méi)有。不是SP3就會(huì)出現(xiàn)上面的錯(cuò)誤。

錯(cuò)誤3:Name mydbcp is not bound in this Context
在context.xml中加入
<ResourceLink
    global="jdbc/mydbcp"
    name="jdbc/mydbcp"
type="javax.sql.DataSource"/>



]]>
Tomcat5.5.12 + mysql5.0 +Eclipse連接池配置http://www.tkk7.com/dazern/articles/32721.html夏天的零度夏天的零度Mon, 27 Feb 2006 11:44:00 GMThttp://www.tkk7.com/dazern/articles/32721.htmlhttp://www.tkk7.com/dazern/comments/32721.htmlhttp://www.tkk7.com/dazern/articles/32721.html#Feedback1http://www.tkk7.com/dazern/comments/commentRss/32721.htmlhttp://www.tkk7.com/dazern/services/trackbacks/32721.html
1.Tomcat5.5.12中沒(méi)有admin模塊,需要讀者自行下載

2.Tomcat中配置如下
        JNDI Name:    jdbc/mysql
            Data Source URL:  jdbc:mysql://202.118.133.88/xscj  
            JDBC Driver Class:   org.gjt.mm.mysql.Driver
            User Name:    root
            Password:     ********
            Max. Active Connections:    4
            Max. Idle Connections:    2
            Max. Wait for Connection:    500
            Validation Query:  
    注:
        1.jdbc/mysql 前綱的jdbc也可以換成其它的, mysql為連池名,可任意起,在下文中注意使用
          2.jdbc:mysql://192.168.0.16/xscj   xscj為對(duì)應(yīng)的數(shù)據(jù)庫(kù)名
              也可以換成jdbc:mysql://localhost/xscj        
         3.JDBC Driver Class : com.mysql.jdbc.Driver   jdk中自帶
       4.User Name:為Mysql中數(shù)據(jù)庫(kù)管理員名

3. 下面是最關(guān)鍵的一點(diǎn)  

D:\Tomcat 5.5\conf\context.xml

<!-- The contents of this file will be loaded for each web application -->
<Context>

    <!-- Default set of monitored resources -->
    <WatchedResource>WEB-INF/web.xml</WatchedResource>
        
    <!-- Uncomment this to disable session persistence across Tomcat restarts -->
    <!--
    <Manager pathname="" />
    -->
<Resource
    name="mysql/xscj"
    type="javax.sql.DataSource"
    password="kingsoft88"
    driverClassName="com.mysql.jdbc.Driver"
    maxIdle="2"
    maxWait="5000"
    username="root"
    url="jdbc:mysql://202.118.133.88:3306/xscj"
    maxActive="4"/>

</Context>

應(yīng)相應(yīng)的字段真加對(duì)了就可以了。

4.在Eclipse中編譯時(shí)加入Tomcat 的DBCP和Pool包就不會(huì)有問(wèn)題了.
測(cè)試程序如下:
<html>
<head>
<title></title>
<%
   out.print("開(kāi)始測(cè)試:"+"<br/>");
   DataSource ds = null;
   Connection con=null;
   try{  
           Context initCtx = new InitialContext();
           Context ctx = (Context) initCtx.lookup("java:comp/env");
                  //這里的數(shù)據(jù)庫(kù)前文提及的Data Source URL配置里包含的數(shù)據(jù)庫(kù)。
           ds = (DataSource)ctx.lookup("jdbc/xscj");
           con=ds.getConnection();
   Statement stmt = con.createStatement();
   String strSql = "select * from xs";                       //表中的字段讀者自行添加
   ResultSet rs = stmt.executeQuery(strSql);
   while(rs.next()){
      out.print(rs.getString(1)+"<br/>");                
     }
        rs.close();
        stmt.close();
       con.close();        
    out.print("我的測(cè)試結(jié)束");
   }
   catch(Exception ex){
       out.print("出現(xiàn)例外,信息是:”+ ex.getMessage());
    ex.printStackTrace();
   }
%>
</head>
<body>
</body>
</html>

總結(jié):以上步驟均十分關(guān)鍵,如果有誤對(duì)應(yīng)錯(cuò)誤如下

1、第一步錯(cuò)誤,報(bào)錯(cuò)
org.apache.commons.dbcp.SQLNestedException: Cannot create JDBC driver of class '' for connect URL 'null'

2、第三步錯(cuò)誤,報(bào)錯(cuò)
javax.naming.NameNotFoundException: Name jdbc is not bound in this Context

3、第四步錯(cuò)誤,報(bào)錯(cuò)
java.sql.SQLException: [Microsoft][SQLServer 2000 Driver for JDBC]Error establishing socket

如果有上述錯(cuò)誤,請(qǐng)檢查對(duì)應(yīng)步驟是否正確實(shí)施

]]>
[轉(zhuǎn)載]Tomcat5.5.12配置詳解http://www.tkk7.com/dazern/articles/32719.html夏天的零度夏天的零度Mon, 27 Feb 2006 11:34:00 GMThttp://www.tkk7.com/dazern/articles/32719.htmlhttp://www.tkk7.com/dazern/comments/32719.htmlhttp://www.tkk7.com/dazern/articles/32719.html#Feedback0http://www.tkk7.com/dazern/comments/commentRss/32719.htmlhttp://www.tkk7.com/dazern/services/trackbacks/32719.html


      今天下載了5.5.12版的TOMCAT,折騰了半天才知道TOMCAT5.0.28之后就沒(méi)有了默認(rèn)的admin模塊,還以為我的配置哪出錯(cuò)了(花了半小時(shí)沒(méi)找出原因:()。下面是網(wǎng)上當(dāng)?shù)囊恍╆P(guān)于TOMCAT配置方面的技巧,對(duì)相關(guān)的配置方法在沒(méi)有改動(dòng)原文的同時(shí)也做了適當(dāng)修改,已紅色字標(biāo)記。目前使用的是最新的jdk為1.5+tomcat5.5.12這里只給出簡(jiǎn)單的配置。
JDK1.5:
JAVA_HOME=c:\j2sdk1.5
classpath=.;%JAVA_HOME%\lib\dt.jar;%JAVA_HOME%\lib\tools.jar;(.;一定不能少,因?yàn)樗懋?dāng)前路徑)
path=%JAVA_HOME%\bin

Tomcat 5.5.12:
CATALINA_HOME:c:\tomcat
CATALINA_BASE:c:\tomcat
TOMCAT_HOME: C:\Tomcat
修改classpath,classpath=.;%JAVA_HOME%\lib\dt.jar;%JAVA_HOME%\lib\tools.jar;%CATALINA_HOME%\common\lib\servlet.jar; 啟動(dòng)tomcat,在IE中訪問(wèn)http://localhost:8080,如果看到tomcat的歡迎頁(yè)面的話(huà)說(shuō)明安裝成功了。

下面可能會(huì)是經(jīng)常出現(xiàn)和遇到的問(wèn)題:
1.下載http://www.eu.apache.org/dist/jakarta/tomcat-5/
這里注意,在jakarta-tomcat-5.0.28.exe以前是有默認(rèn)的admin模塊,在jakarta-tomcat-5.5.9.exe則沒(méi)有安裝默認(rèn)的admin模塊,這時(shí)http://127.0.0.1:8080/admin打開(kāi)時(shí)則會(huì)出現(xiàn)
Tomcat's administration web application is no longer installed by default. Download and install the "admin" package to use it.
因此我們現(xiàn)在需要下載"admin"package 包
把jakarta-tomcat-5.5.x.zip 與 jakarta-tomcat-5.5.x-compat.zip 與 jakarta-tomcat-5.5.x-admin.zip三個(gè)文件解壓在同一個(gè)目錄中(如果使用jdk1.4,才需要compat.zip用jdk1.5就可以免了這個(gè)。) 如果使用的是JDK1.5+tomcat5.5.12只需要將jakarta-tomcat-5.5.x-admin.zip文件解壓到TOMCAT目錄即可.

2.修改jakarta-tomcat-5.5.x\conf\tomcat-users.xml.
添加管理員賬號(hào)lizongbo,密碼為lizongbopass.(一般在安裝Tomcat的同時(shí)已提示輸入用戶(hù)名及密碼,如果有設(shè)置此處可不做修改。)
新xml如下:

有時(shí)在%CATALINA_HOME%\server\webapps\admin\WEB-INF\web.xml里面也要做些修改

Tomcat Server Configuration Security Constraint

Protected Area

*.jsp
*.do
*.html

admin

FORM
Tomcat Server Configuration Form-Based Authentication Area
/login.jsp /error.jsp



The role that is required to log in to the Administration Application

admin


無(wú)論是 Authetication (身份驗(yàn)證還是 Authorization ( 權(quán)限管控都只有設(shè)置相關(guān)的admin ROLE,當(dāng)你想要新增或修改相關(guān)的AA, 就必須修改這一個(gè)文件,來(lái)符合你的環(huán)境.

3.修改jakarta-tomcat-5.5.x\conf\server.xml來(lái)解決編碼問(wèn)題。
(給Connector 添加URIEncoding參數(shù),參考http://blog.csdn.net/darkxie/archive/2004/10/25/TOMCATAPP.aspx)
(可以設(shè)置成GB18030)
maxThreads="150" minSpareThreads="25" maxSpareThreads="75"
enableLookups="false" redirectPort="8443" acceptCount="200"
connectionTimeout="20000" disableUploadTimeout="true" URIEncoding="GBK"
compression="on" compressionMinSize="2048"
noCompressionUserAgents="gozilla, traviata"
compressableMimeType="text/html,text/xml"/>

enableLookups="false" redirectPort="8443" protocol="AJP/1.3" URIEncoding="GBK"/>
(這個(gè)還是比較頭痛的問(wèn)題,試了幾種方法都不是太理想,有待繼續(xù)解決,maxHttpHeaderSize="8192")

4.啟用支持gzip壓縮.
(http://www.linuxaid.com.cn/forum/showdoc.jsp?l=1&i=81169)
添加下列屬性
compression="on"
compressionMinSize="2048"
noCompressionUserAgents="gozilla, traviata"
compressableMimeType="text/html,text/xml"

5.設(shè)置虛擬主機(jī)。
在jakarta-tomcat-5.5.x\下建立文件夾vhost\www.mydomain.com。
然后修改jakarta-tomcat-5.5.x\conf\server.xml

6.添加數(shù)據(jù)庫(kù)驅(qū)動(dòng),更新mail.jar和actiovation.jar
復(fù)制mysql-connector-java-3.0.16-ga-bin.jar,pg74.215.jdbc3.jar到 jakarta-tomcat-5.5.x\common\lib\
還有javamail 1.3.2的mail.jar,jaf-1_0_2的 activation.jar
msSQl 2000 JDBC sp3,msbase.jar,msutil,jar,mssqlserver.jar

7.配置SSL
參考 http://jakarta.apache.org/tomcat/tomcat-5.5-doc/ssl-howto.html
D:\j2sdk1.4.2_06\bin>%JAVA_HOME%\bin\keytool -genkey -alias tomcat -keyalg RSA
輸入keystore密碼: lizongbossl
您的名字與姓氏是什么?
[tomcat5.5.x]: tomcat5.5.x
您的組織單位名稱(chēng)是什么?
[jakarta]: jakarta
您的組織名稱(chēng)是什么?
[apache]: apache
您所在的城市或區(qū)域名稱(chēng)是什么?
[hzcity]: hzcity
您所在的州或省份名稱(chēng)是什么?
[gdp]: gdp
該單位的兩字母國(guó)家代碼是什么
[CN]: CN
CN=tomcat5.5.x, OU=jakarta, O=apache, L=hzcity, ST=gdp, C=CN 正確嗎?
[否]: y

輸入的主密碼
(如果和 keystore 密碼相同,按回車(chē)):

(必須密碼一致,因此直接回車(chē))
然后再把userhome(例如:C:\Documents and Settings\lizongbo\)下的.keystore復(fù)制到
tomcat的conf\目錄下。
(例如:D:\jakarta-tomcat-5.5.x\conf\.keystore
配置jakarta-tomcat-5.5.x\conf\server.xml
加上
maxThreads="150" minSpareThreads="25" maxSpareThreads="75"
enableLookups="false" disableUploadTimeout="true"
acceptCount="100" scheme="https" secure="true"
clientAuth="false" sslProtocol="TLS"
keystoreFile="conf/.keystore"
keystorePass="lizongbossl">

8.禁止文件目錄列表,
修改jakarta-tomcat-5.5.x\conf\web.xml,把listing設(shè)置為false

default
org.apache.catalina.servlets.DefaultServlet
debug 0
listings true
1

9.指定了自己的javaEncoding
(參考 http://gceclub.sun.com.cn/staticcontent/html/sunone/app7/app7-dg-webapp/ch6/ch6-4.html

jsp
org.apache.jasper.servlet.JspServlet

fork false


javaEncoding GB18030


xpoweredBy true

3

10.添加rar,iso等的mime-type映射
避免在瀏覽器里直接打開(kāi)。

mht
text/x-mht

rar
application/octet-stream

iso
application/octet-stream

ape
application/octet-stream

rmvb
application/octet-stream

ico
image/x-icon

10.1對(duì)html靜態(tài)頁(yè)面設(shè)置編碼

htm
text/html;charset=gb2312

html
text/html;charset=gb2312

11.添加welcome-file-list,并調(diào)整順序。

index.jsp
index.html
index.htm
default.html
default.htm
default.jsp



]]>
主站蜘蛛池模板: 无码乱肉视频免费大全合集| 无遮挡呻吟娇喘视频免费播放| 亚洲高清在线mv| 亚洲国产成人精品无码区在线观看 | 国产亚洲成av人片在线观看| 亚洲VA综合VA国产产VA中| 亚洲av无码乱码在线观看野外 | 日韩吃奶摸下AA片免费观看| 在线观看AV片永久免费| 国产一精品一AV一免费孕妇| 成年女人免费碰碰视频| 一本天堂ⅴ无码亚洲道久久| 亚洲精品卡2卡3卡4卡5卡区| 亚洲国产精品成人精品无码区 | 激情内射亚洲一区二区三区| 337p日本欧洲亚洲大胆精品555588| 1区1区3区4区产品亚洲| 91嫩草亚洲精品| 亚洲国产精品无码专区在线观看| 亚洲av无码乱码国产精品fc2| 久久久国产精品亚洲一区| 亚洲噜噜噜噜噜影院在线播放| 亚洲最大的成人网| 狠狠热精品免费观看| 99久久免费国产特黄| 午夜视频免费在线观看| 无码国产精品久久一区免费| 免费国产a国产片高清| 国产亚洲成人久久| 亚洲色欲或者高潮影院| 亚洲国产日韩a在线播放| 亚洲AV无码乱码在线观看代蜜桃| 亚洲欧美自偷自拍另类视| 日韩久久无码免费毛片软件| 国产午夜精品免费一区二区三区| aⅴ免费在线观看| 91制片厂制作传媒免费版樱花| 免费国产污网站在线观看| 免费h片在线观看网址最新| 国产日产成人免费视频在线观看| 国产亚洲AV手机在线观看|