首页index.jsp有个登录表单,提交到UserLoginServelt验证合法性。可是当我提交后显示
type Status reportmessage /test/servelt/UserLoginServletdescription The requested resource (/test/servelt/UserLoginServlet) is not available.index.jsp中相关代码为:<form action="<%= request.getContextPath()%>/UserLoginServlet" name="form1" method="post" onSubmit="return login11()">我的项目的结构如图
type Status reportmessage /test/servelt/UserLoginServletdescription The requested resource (/test/servelt/UserLoginServlet) is not available.index.jsp中相关代码为:<form action="<%= request.getContextPath()%>/UserLoginServlet" name="form1" method="post" onSubmit="return login11()">我的项目的结构如图
return login11() 查看此方法里面做了什么
进入servlet 打断点,如果没进入servlet说明路径有错误
进入servlet 到返回时报错404,说明是返回的路径有问题找不到页面
<description>This is the description of my J2EE component</description>
<display-name>This is the display name of my J2EE component</display-name>
<servlet-name>UserLoginServlet</servlet-name>
<servlet-class>servlet.UserLoginServlet</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>UserLoginServlet</servlet-name>
<url-pattern>/UserLoginServlet</url-pattern>
</servlet-mapping>
这个配置的不正确吧,要不你就直接:<form action="UserLoginServlet" name="form1" method="post" onSubmit="return login11()">
++1估计是你编译有问题,你检查一下是否有/WEB_INF/classes/servlet/UserLoginServlet.class这个文件