求助。。JSP不能进行表单验证;跳转到servlet名为Login,出现404错误
源代码如下:
<%@ page language="java" import="java.util.*" pageEncoding="gbk"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<base href="<%=basePath%>">
<title>My JSP 'index.jsp' starting page</title>
<meta http-equiv="pragma" content="no-cache">
<meta http-equiv="cache-control" content="no-cache">
<meta http-equiv="expires" content="0">
<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
<meta http-equiv="description" content="This is my page">
<!--
<link rel="stylesheet" type="text/css" href="styles.css">
-->
<!-- 验证输入用户名密码格式 -->
<script type="text/javascript">
function checkForm()
{
if(form1.userId.value == "")
{
alert("用户名不能为空");
form1.userId.focus();
return false;
}
if(form1.pwd.value == "")
{
alert("密码不能为空");
form1.userId.focus();
return false;
}
for(var i=0;i <3;i++)
{
if(i==2){alert("密码不能为空");return false;}
if(document.all.shengfen[i].checked){
reutrn true;
}
}
if(form1.userId.value.length<6||form1.userId.value.length>12)
{
alert("用户名输入长度错误,长度应介于6与12位之间");
form1.userId.focus();
return false;
}
if(form1.pwd.value.length<6||form1.pwd.value.length>12)
{
alert("密码输入长度错误,长度应介于6与12位之间");
form1.pwd.focus();
return false;
}
}
</script>
</head>
<body bgcolor="gray">
<h1 align="center"> 欢迎来到武科大教务管理系统</h1>
<hr>
<table width="99%" border="0">
<tr>
<td height="71" colspan="3"><h1 align="center">welcome</h1></td>
</tr>
<tr>
<td height="203"> </td>
<td width="42%">
<form action="./Login" method="post" name="form1">
<input type=hidden name="commitFlag" value="submit">
<table width="100%" border="0">
<tr>
<td width="66%" height="56" align="right"><span>用户名:</span></td>
<td width="54%"><input name="userId" type="text" class="text1" size="10" maxlength="16"></td>
</tr>
<tr>
<td height="47" align="right"><span >密码: </span></td>
<td><input name="pwd" type="password" class="text1" size="10" maxlength="16"></td>
</tr>
<tr>
<td width="46%" height="56" align="right"><span >身份:</span></td>
<td width="54%">
<input type="radio" name="shengfen" value="teacher" />教师<br>
<input type="radio" name="shengfen" value="student" />学生<br>
<input type="radio" name="shengfen" value="db" />管理员<br>
</td>
</tr>
<tr>
<td height="40" align="right"> </td>
<td align="left">
<input name="submintButton" type="submit" class="button1" value="确定" onclick="return checkForm()" >
<input name="reset" type="reset" class="button1" id="reset" value="取消">
</td>
</tr>
</table>
</form>
</td>
<td width="45%"> </td>
</tr>
<tr>
<td height="235"> </td>
<td> </td>
<td> </td>
</tr>
</table>
</body>
</html>