试试访问地址:
http://localhost/MYWEB/servlet/servletName

解决方案 »

  1.   

    呵呵,写servlet吗?
    这样来吧:)webapps/myweb
    把webapps/root/WEB-INF/web.xml  copy  到/webapps/myweb/WEB-INF/去
    然后在webapps/myweb/WEB-INF/classes/com/test/新建hello.java文件,把你最简单的servlet放进去啊,public class写成hello啊,然后最上面package写成com.test,把这个文件用javac编译生成一个hello.class文件
    然后写server.xml,得必须让tomcat认出来你这个context啊
    打开server.xml搜索<Context Path=
    然后在该段后面添加自己的<Context Path="/myweb" docBase="myweb" />
    其次,写web.xml
    <servlet>
    <servlet-name>hello</servlet-name>
    </servlet-class>com.test.hello</servlet-class>
    </servlet>
    <servlet-mapping>
    <servlet-name>hello</servlet-name>
    <url-pattern>/hello</url-pattern>
    </servlet-mapping>
    注意先后顺序。
    注意保存啊,然后重新启动tomcat,打开http://localhost:8080/hello
    就可以看见了