1.设置TOMCAT默认字符集和端口
conf/server.xml
<Connector
port="80" maxThreads="150" minSpareThreads="25" maxSpareThreads="75"
enableLookups="false" redirectPort="8443" acceptCount="100"
debug="0" connectionTimeout="20000"
disableUploadTimeout="true"
URIEncoding="UTF-8"
/>
<Connector
port="80" maxThreads="150" minSpareThreads="25" maxSpareThreads="75"
enableLookups="false" redirectPort="8443" acceptCount="100"
debug="0" connectionTimeout="20000"
disableUploadTimeout="true"
URIEncoding="UTF-8"
/>
修改port="80"
添加URIEncoding="UTF-8"
2.TOMCAT添加角色
conf/tomcat-users.xml中添加
<role rolename="admin"/>
<role rolename="manager"/>
<user username="admin" password="1" roles="admin,manager"/>
<role rolename="admin"/>
<role rolename="manager"/>
<user username="admin" password="1" roles="admin,manager"/>
3.TOMCAT指定WEB服务路径
conf\Catalina\localhost
添加WEB服务名.xml
<Context docBase="绝对路径"/>
添加WEB服务名.xml
<Context docBase="绝对路径"/>
4.设置TOMCAT默认WEB服务
conf/server.xml
<Host>
添加<Context path="" docBase="web服务绝对路径" reload="true" />
</Host>
<Host>
添加<Context path="" docBase="web服务绝对路径" reload="true" />
</Host>
5.设置TOMCAT可查看源代码
conf/server.xml
<servlet>
<servlet-name>default</servlet-name>
<servlet-class>org.apache.catalina.servlets.DefaultServlet</servlet-class>
<init-param>
<param-name>debug</param-name>
<param-value>0</param-value>
</init-param>
<init-param>
<param-name>listings</param-name>
修改<param-value>true</param-value>
</init-param>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet>
<servlet-name>default</servlet-name>
<servlet-class>org.apache.catalina.servlets.DefaultServlet</servlet-class>
<init-param>
<param-name>debug</param-name>
<param-value>0</param-value>
</init-param>
<init-param>
<param-name>listings</param-name>
修改<param-value>true</param-value>
</init-param>
<load-on-startup>1</load-on-startup>
</servlet>