Topic: servlet +tomcat 老抱404错误 ! |
Print this page |
1.servlet +tomcat 老抱404错误 ! | Copy to clipboard |
Posted by: heartache Posted on: 2006-05-12 21:53 手工配置servlet ,在eclipse下文件 temp/WEBROOT/WEB-INT/classes 同时配置web.xml , JAVA文件如下: import java.io.*; import javax.servlet.*; import javax.servlet.http.*; public class servletDemo extends HttpServlet { public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { response.setContentType("text/html;charset=gbk"); PrintWriter out = response.getWriter(); out.println("今天天气不错!"); out.close(); } public void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { doGet(request,response); } } 保存为 servletDemo.java web.xml配置如下 : <?xml version="1.0" encoding="UTF-8"?> <web-app> <servlet> <servlet-name>aa</servlet-name> <servlet-class>servletDemo</servlet-class> </servlet> <servlet-mapping> <servlet-name>aa</servlet-name> <url-pattern>/hijack</url-pattern> </servlet-mapping> </web-app> 拷贝WEBROOT到tomcat 的webapps目录下,运行浏览器,报告错误,404,而且启动 tomacat 下bin的 startup.bat, 错误见附件 1.BMP (668.76k) |
2.Re:servlet +tomcat 老抱404错误 ! [Re: heartache] | Copy to clipboard |
Posted by: heartache Posted on: 2006-05-12 21:56 浏览器运行结果为 23.BMP (256.77k) |
3.Re:servlet +tomcat 老抱404错误 ! [Re: heartache] | Copy to clipboard |
Posted by: K_P_exciting Posted on: 2006-05-19 21:36 404错误多半是你没有放对地方,所以小猫找不到!!!把编译生成的servletDemo.class放到WEBROOT/WEB-INF/classes目录下,然后在浏览器中: http://localhost:8080/WEBROOT/hijack 看看这样行不!!端口如果是80就不用加了! |
Powered by Jute Powerful Forum® Version Jute 1.5.6 Ent Copyright © 2002-2021 Cjsdn Team. All Righits Reserved. 闽ICP备05005120号-1 客服电话 18559299278 客服信箱 714923@qq.com 客服QQ 714923 |