在server.xml中指定
在Tomcat的配置檔案中,一個Web應用就是一個特定的Context,可以通過在server.xml中建立Context裡部署一個JSP應用程式。打開server.xml檔案,在Host标簽内建一個Context,内容如下。
在tomcat中的conf目錄中,在server.xml中的,<host/>節點中添加:
<Context path="" reloadable="true" docBase="/home/www/xxx" reloadable="true" />
說明:
path是虛拟路徑,值為空。
docBase 是項目所在的實體路徑,它可以不是tomcat下webapps路徑。