Tomcat主機在windows上安裝和部署配置教程

來源:互聯網
上載者:User

Tomcat安裝教程

1.雙擊.exe安裝程式,顯示如下圖所示的歡迎頁面。

2.點擊next按扭出現如下圖所示的頁面

3.點擊I Agree進入下一步安裝步驟,點擊Next按扭進入下一步。

>

4.若想更改tomcat的安裝路徑可通過點擊Browse按扭來完成。點擊Next按扭繼續安裝。

5.設定連接埠,預設8080,如果被佔用加選,User Name 管理員名稱 Password 管理員密碼,本頁所以選項都選擇預設,點擊Next進入下一步。這步很重要,Please select the path of the JVM installed on your system: 如果您這裡自動找到JDK的路徑(如 C:j2sdk1.4.2)那麼可以肯定能安裝成功,如果不能找到請不要繼續,請選設定好JAVA_HOME環境變數,如果您能清楚的記得在安裝完成後 你去配置JAVA_HOME那麼也可以。

6.點擊Install按扭進行安裝,最後點擊完成按扭既可完成安裝。

 

tomcat配置教程

tomcat安裝完成後,修改以下檔案:

安裝目錄下(以C盤為例)

c$Program FilesApache Software FoundationTomcat 8.0confserver.xml

1)找到host標籤,添加以下內容

 代碼如下 複製代碼

<Host name="mobilebi.lncrland.com"  appBase="mobilebi" unpackWARs="true" autoDeploy="true">
<Context path="/" reloadable="true" docBase="" workDir=""/>
</Host>



2)找到以下目錄,並建立新增主機使用目錄mobilebi,並在目錄下建立應用所需檔案

c$Program FilesApache Software FoundationTomcat 8.0 並建立子目錄mobilebi
在mobilebi子目錄下建立WEB-INF、Jsp、Jpg、Js等目錄用於存放不同檔案

3)在WEB-INF子目錄下建立 web.xml檔案 和 classes目錄

最終形成以下結構:

 

 

 代碼如下 複製代碼
c$Program FilesApache Software FoundationTomcat 8.0
+conf
      server.xml(增加主機配置)
+mobilebi
      +WEB-INF
          +classes
               (目錄下存放類包名類名)
           web.xml(配置servlet映射)


 

------------------------------------
案例如下:

1)server.xml添加主機

 代碼如下 複製代碼

<Host name="mobilebi.lncrland.com"  appBase="mobilebi" unpackWARs="true" autoDeploy="true">
<Context path="/" reloadable="true" docBase="" workDir=""/>
</Host>



2)web.xml配置

 代碼如下 複製代碼

<?xml version="1.0" encoding="ISO-8859-1"?>
<!--
  Licensed to the Apache Software Foundation (ASF) under one or more
  contributor license agreements.  See the NOTICE file distributed with
  this work for additional information regarding copyright ownership.
  The ASF licenses this file to You under the Apache License, Version 2.0
  (the "License"); you may not use this file except in compliance with
  the License.  You may obtain a copy of the License at

      http://www.apache.org/licenses/LICENSE-2.0

  Unless required by applicable law or agreed to in writing, software
  distributed under the License is distributed on an "AS IS" BASIS,
  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  See the License for the specific language governing permissions and
  limitations under the License.
-->
<web-app xmlns="http://xmlns.jcp.org/xml/ns/javaee"
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee
                      http://xmlns.jcp.org/xml/ns/javaee/web-app_3_1.xsd"
  version="3.1"
  metadata-complete="true">
 
    <!-- Define servlets that are included in the example application -->
    <servlet>
        <servlet-name>Servlet1</servlet-name>
        <servlet-class>biServlet.SaleArea</servlet-class>
    </servlet>

    <servlet-mapping>
        <servlet-name>Servlet1</servlet-name>
        <url-pattern>/sale/area</url-pattern>
    </servlet-mapping>
 
   <servlet>
        <servlet-name>Servlet2</servlet-name>
        <servlet-class>biServlet.SignMoney</servlet-class>
    </servlet>

    <servlet-mapping>
        <servlet-name>Servlet2</servlet-name>
        <url-pattern>/sale/signMoney</url-pattern>
    </servlet-mapping>
</web-app>

 

相關文章

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.