给大家说一下我的情况
TOMCAT-HOME=G:/tomcat
然后在webapps下面自己建立了一个工作目录zhukai,以下是server.xml的配置
<?xml version="1.0" encoding="ISO-8859-1"?>
<!--
Copyright 1999-2004 The Apache Software Foundation
Licensed 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.
-->
<Server>
<!-- You can add a "home" attribute to represent the "base" for
all relative paths. If none is set, the TOMCAT_HOME property
will be used, and if not set "." will be used.
webapps/, work/ and log/ will be relative to this ( unless
set explicitely to absolute paths ).
-->
<ContextManager workDir="work" >
<!-- ==================== Global modules ==================== -->
<LoaderInterceptor11 useApplicationLoader="true" />
<TrustedLoader />
<LogSetter name="tc_log" timestamps="true"
verbosityLevel="INFORMATION" />
<LogEvents enabled="false" />
<!-- Backward compat: read the Context declarations from server.xml-->
<ContextXmlReader config="conf/server.xml" />
<!-- Separated Context -->
<ContextXmlReader config="conf/apps.xml" />
<AutoDeploy source="modules" target="modules"
redeploy="true" />
<AutoWebApp dir="modules" host="DEFAULT" trusted="true"/>
<AutoDeploy source="webapps" target="webapps" />
<AutoWebApp dir="webapps" host="DEFAULT" />
<PolicyLoader securityManagerClass="java.lang.SecurityManager"
policyFile="conf/tomcat.policy" />
<SimpleMapper1 />
<SessionExpirer checkInterval="60" />
<!-- For development you can use randomClass="java.util.Random" -->
<SessionIdGenerator randomClass="java.security.SecureRandom"
randomFile="/dev/urandom" />
<!-- ========== context processing modules ========== -->
<!-- This will be the "default" profile
( all except the "global" modules can be set per context )
-->
<LogSetter name="servlet_log"
timestamps="true"
verbosityLevel = "INFORMATION"
path="logs/servlet-${yyyyMMdd}.log"
/>
<LogSetter name="JASPER_LOG"
timestamps="true"
path="logs/jasper-${yyyyMMdd}.log"
verbosityLevel = "INFORMATION" />
<WebXmlReader validate="true" />
<ErrorHandler showDebugInfo="true" />
<WorkDirSetup cleanWorkDir="false" />
<Jdk12Interceptor />
<!-- Non-standard invoker, for backward compat. ( /servlet/* ) -->
<InvokerInterceptor />
<!-- you can add javaCompiler="jikes" -->
<JspInterceptor keepGenerated="true"
largeFile="false"
useJspServlet="false"
/>
<StaticInterceptor listings="true"
useAcceptLanguage="true"
useCharset="locale" />
<ReloadInterceptor fullReload="true" />
<SimpleSessionStore maxActiveSessions="-1" />
<AccessInterceptor />
<CredentialsInterceptor />
<SimpleRealm filename="conf/users/global-users.xml" />
<!-- UnComment the following and comment out the
above to get a JDBC realm.
Other options for driverName:
driverName="oracle.jdbc.driver.OracleDriver"
connectionURL="jdbc:oracle:thin:@ntserver:1521:ORCL"
connectionName="scott"
connectionPassword="tiger"
driverName="org.gjt.mm.mysql.Driver"
connectionURL="jdbc:mysql://localhost/authority"
connectionName="test"
connectionPassword="test"
"connectionName" and "connectionPassword" are optional.
-->
<!--
<JDBCRealm
debug="99"
driverName="sun.jdbc.odbc.JdbcOdbcDriver"
connectionURL="jdbc:odbc:TOMCAT"
userTable="users"
userNameCol="user_name"
userCredCol="user_pass"
userRoleTable="user_roles"
roleNameCol="role_name" />
-->
<LoadOnStartupInterceptor />
<Servlet22Interceptor />
<!-- Tag pooling support.
To enable the reuse of tag handlers as described in
the JSP spec, uncomment the following. If your pages
use a lot of custom tags, you should see a nice performance
gain.
Note that placing the interceptor here will enable
Tag pooling for all of the web applicatitions loaded -
this may be a bad thing if all tags are not coded to
handle reuse. To enable pooling only for specific web
applications i.e. Contexts, place the interceptor inside of
the Context's definition.
To view information about tag usage uncomment the tag
LogSetter. Set verbosityLevel to DEBUG to see everytime
a tag is obtained and released.
-->
<!--
<LogSetter name="tag_pool_log" timestamps="true"
path="logs/tagpool-${yyyyMMdd}.log"
verbosityLevel="INFORMATION" />
<TagPoolManagerInterceptor />
-->
<!-- Request processing -->
<DecodeInterceptor />
<!-- If you are running SSL and wish to verify Tomcat sessions
against SSL sessions, use checkSSLSessionId="true"
Default is checkSSLSessionId="false" -->
<SessionId cookiesFirst="true" noCookies="false" />
<!-- Automatic config generation
Set noRoot="false" if you wish to have Tomcat try to take
control of the external web server's root context.
Additonal configuration of the external web server may be
required for this to be successful.
Note: Configuration files are not written as part of the
default startup behvior. Append "jkconf" to the startup
command to have Tomcat initialize, write the config files,
then exit. This may be done while Tomcat is running.
-->
<ApacheConfig noRoot="true" />
<IISConfig noRoot="true" />
<NSConfig noRoot="true" />
<!-- Uncoment for apache-style logs
Attributes: logFile, flush, format
<AccessLogInterceptor/>
-->
<!-- ==================== Connectors ==================== -->
<!-- old http adapter. Attributes:
secure - use SSL ( https )
keystore, keypass - certs for SSL
port
reportedname - Server name to send back to browser
by default report Tomcat Web Server ...
set an empty string to avoid sending server head
er
-->
<!-- Uncomment this if useing a 1.1 JDK
<Http10Connector port="8080"
secure="false"
maxThreads="100"
maxSpareThreads="50"
minSpareThreads="10" />
-->
<!--
Uncomment this for SSL support. You _need_ to set up a
server certificate if you want this to work, and you
need JSSE. See tomcat-ssl-howto.html for more detailed
instructions.
1. Make the JSSE jars available to Tomcat, either by making
them an installed extension or by adding them to the
Tomcat CLASSPATH.
2. Do: keytool -genkey -alias tomcat -keyalg RSA
RSA is essential to work with Netscape and IIS.
Use "changeit" as password. ( or add keypass attribute )
You don't need to sign the certificate.
-->
<!--
<Http10Connector port="8443" secure="true" />
-->
<!--
HTTP 1.1 support using the Coyote adapter and
and Http11 processor from jakarta-tomcat-connectors.
Note: CoyoteConnector supports the same attributes as
Http10Connector
-->
<CoyoteConnector port="8080"
maxThreads="150" minSpareThreads="25" maxSpareThreads="75"
enableLookups="false" acceptCount="100"
debug="0" connectionTimeout="20000"
disableUploadTimeout="true" />
<!-- Note : To disable connection timeouts, set connectionTimeout valu
e
to -1 -->
<!-- Note : To use gzip compression you could set the following proper
ties :
compression="on"
compressionMinSize="2048"
noCompressionUserAgents="gozilla, traviata"
compressableMimeType="text/html,text/xml"
-->
<!--
JNI connector. It assumes the library is located in
TOMCAT_HOME/bin/native/jni_connect.[dll, nlm, so]. or in LD_LIBRA
RY_PATH.
For different paths set "nativeLibrary" parameter.
The JniConnector will be self-enable only if JNI mode is detected
.
-->
<JniConnector />
<!-- Apache AJP12 support. This is also used to shut down tomcat.
Parameter "address" defines network interface this Interceptor
"binds" to. Add it if you want to "bind" to just "127.0.0.1".
address="127.0.0.1"
Parameter "tomcatAuthentication", controls if Tomcat honors
( and uses ) auth done in HTTP Server or not, when true Tomcat do
es
not use in any way auth information provided by the HTTP Server.
true is the default.
tomcatAuthentication="false"
-->
<Ajp12Connector port="8007" />
<!-- Apache AJP13 support (mod_jk)
Parameter "address" defines network interface this Interceptor
"binds" to. Add it if you want to "bind" to just "127.0.0.1".
address="127.0.0.1"
Parameter "tomcatAuthentication", controls if Tomcat honors
( and uses ) auth done in HTTP Server or not, when true Tomcat do
es
not use in any way auth information provided by the HTTP Server.
true is the default.
tomcatAuthentication="false"
-->
<!-- old JK support. Uncomment if you need to use a 1.1 JDK
<Ajp13Connector port="8009" />
-->
<!-- Jk2 support using coyote. -->
<CoyoteConnector processorClassName="org.apache.jk.server.JkCoyoteHand
ler"
port="8009" />
<!--
Context definitions can be placed here ( not recommended ) or
in separate files. The ContextXmlReader will read all context
definitions ( you can customize the "base" filename ).
The default is conf/apps-[name].xml.
See conf/apps-examples.xml and conf/apps-admin.xml
-->
<context path="/zhukai" docBase="G:/tomcat/webapps/zhukai" debug="0" reloa
dable="true">
</context>
</ContextManager>
</Server>
然后在zhukai下面有一个WEB-INF目录,再下面是web.xml文件,如下:
<?xml version="1.0" encoding="ISO-8859-1"?>
<!--
Copyright 1999-2004 The Apache Software Foundation
Licensed 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.
-->
<!DOCTYPE web-app
PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.2//EN"
"http://java.sun.com/j2ee/dtds/web-app_2_2.dtd">
<web-app>
<servlet>
<servlet-name>helloworld</servlet-name>
<servlet-class>HelloWorldServlet</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>helloworld</servlet-name>
<url-pattern>/servlet/HelloWorldServlet</url-pattern>
</servlet-mapping>
</web-app>
在WEB-INF下面还有一个classes目录用来存放servlet我写的HelloWorldSevlet就放在下面
当我在浏览器中输入
http://localhost:8080/zhukai/servlet/HelloWorldServlet的时候
怎么出现这样的错误:资源不允许(HTTP method is not supported by this URL).
--
FROM 218.197.196.*