日期:2014-05-18  浏览次数:20611 次

tomcat中找不到servlet
我编写了一个servlet   Dispatch.java,通过index.jsp调用,

index.jsp代码如下:
<%@   page   language= "java "   contentType= "text/html;   charset=gb2312 "%>

<html>
<head>
<title> MyStore </title>
</head>
<body>
<h1> Welcome   to   MyStore </h1>
<p> Click   here   to   <a   href= " <%=response.encodeURL( "dispatch?operation=browse ")   %> "> browse   the   catalog </a>
</body>
</html>

我用的是eclipse开发,Dispatch.java位于\WEB-INF\src\mystore.servlet包内web.xml中servlet设置如下:
<servlet>
  <servlet-name> dispatcher </servlet-name>
  <servlet-class> mystore.servlet.Dispatcher </servlet-class>
</servlet>
<servlet-mapping>
  <servlet-name> dispatcher </servlet-name>
  <url-pattern> /dispatch </url-pattern>
</servlet-mapping>

运行后点击browse   the   catalog链接提示如下:
HTTP   Status   404   -   /dispatch

--------------------------------------------

type   Status   report

message   /dispatch

description   The   requested   resource   (/dispatch)   is   not   available.

是不是servlet设置错了??或者是请求错误?请高手帮忙解决下,谢谢。。。


------解决方案--------------------
看看有没有\WEB-INF\classes\mystore\servlet\Dispatcher.class文件?
------解决方案--------------------
如果可以的话,把你的应用打个包发给我ihway@163.com
我试试