日期:2014-05-17 浏览次数:20774 次
<!DOCTYPE html>
<html>
<head>
<title>SerializeTest.html</title>
<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
<meta http-equiv="description" content="this is my page">
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<script type="text/javascript" src="js/jquery-1.8.3.min.js">
</script>
<script type="text/javascript">
$(function(){
$("form [type='button']").click(function(){
var str=$("form").serialize();
//alert(str);
$("div").load("/Test/serialize?"+str,function(){
alert($("div").val());
});
});
});
</script>
</head>
<body>
<div id="d">
</div>
<form id="f">
用户姓名:<input name="username" type="text">
<br>
密码 :<input name="password" type="text">
<br>
<input value="submit" type="button">
</form>
</body>
</html>
package cn.itcast.servlet;
import java.io.IOException;
import java.io.PrintWriter;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.