完成目标:利用MyEclipse和jQuery完成登录验证和获取所填数据功能。
1.注册页面请求信息获取
登录界面代码:
<%@ page language="java" import="java.util.*"
pageEncoding="utf-8" contentType="text/html;charset:utf-8"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<html>
<head>
<base href="<%=basePath%>">
<title>百度用户注册</title>
<meta charset="utf-8">
<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">
<script type="text/javascript" src="js/jquery-1.4.2.min.js"></script>
<script>
function tijiao(){
alert("提交");
document.baseform.submit();
}
</script>
</head>
<body>
<form action="showbaidu.jsp" method="post" name="baseform">
<table border="1" >
<tr>
<td>用户名:</td>
<td><input type="text" name="name"> 只能输入字母或者数字,4-16个字符</td>
</tr>
<tr>
<td>密码:</td>
<td><input type="text" name="pwd"> 密码长度6-12位</td>
</tr>
<tr>
<td>确认密码:</td>
<td><input type="text" name="pwd1"></td>
</tr>
<tr>
<td>性别:</td>
<td><input type="radio" name="sex" value="男" checked>男
<input type="radio" name="sex" value="女">女
</td>
</tr>
<tr>
<td>电子邮件地址:</td>
<td><input type="text" name="mail">输入正确的Email地址</td>
</tr>
<tr>
<td>兴趣爱好:</td>
<td>
<input type="checkbox" name="sport" value="体育">体育
<input type="checkbox" name="sport" value="读书">读书
<input type="checkbox" name="sport" value="音乐">音乐
<input type="checkbox" name="sport" value="旅游">旅游
</td>
</tr>
</table>
<input type="button" value="同意以下条款并提交" style="float: left" id="bt" οnclick="tijiao()">
<textarea rows="5" cols="30">
百度条款...
</textarea>
</form>
</body>
</html>
显示页面代码:
<%@ page language="ja