编写web.xml文件时,运行项目发现弹出窗口,如下
解决办法:
仔细查找了一下,发现是代码打错了(太粗心了,打手!
<servlet>
<description>验证码</description>
<servlet-name>CpachaServlet</servlet-name>
<servlet-class>com.WYC.programmer.servlet.CpachaServlet</servlet-class> <!--告诉Servlet它的类在哪里 -->
</servlet>
<servlet-mapping>
<servlet-name>CpachaServlet</servlet-name>
<url-pattern>com.WYC.programmer.servlet.CpachaServlet</url-pattern><!--告诉Servlet对应的地址是哪个 -->
</servlet-mapping>
更正为
<servlet>
<description>验证码</description>
<servlet-name>CpachaServlet</servlet-name>
<servlet-class>com.WYC.programmer.servlet.CpachaServlet</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>CpachaServlet</servlet-name>
<url-pattern>/CpachaServlet</url-pattern> //与浏览器对接,将网页上CpachaServlet的请求返回到CpachaServlet.java文件中
</servlet-mapping>