request.getParameter(“xxx”)的参数的取值
request.getParameter(“xxx”)的参数的取值的几种可能:
-
Html中form表单中标签的name属性:
<form name="form" method="post" action="checkUser">
请输入用户姓名:<input type="text" name="username">
<input type="submit" name="Submit" value="提交">
</form>
request.getParameter(“username”);
-
Html中form表单提交时的action的参数
<form name="form" method="post" action="checkUser?Flag=1&Id=2">
请输入用户姓名:<input type="text" name="username">
<input type="submit" name="Submit" value="提交">
</form>
request.getParameter(“username”);
request.getParameter(“Flag”);
request.getParameter(“Id”);
-
Html中url的内容
<a href="SortServlet?flag=5&temp=2" οnclick="sort()"><img src="images/cbsj.jpg" /></a>
request.getParameter(“flag”);
request.getParameter(“temp”);
-
Ajax中的data
<form name="form" action="" method="post">
<div style="margin-bottom:10px;">
<input class="TxtUserNameCssClass" type="text" id="UserCode" value="" />
</div>
<div style="margin-top:20px;">
<input class="TxtPasswordCssClass" type="Password" id="UserPwd" value="" />
</div>
</form>
<div class=IbtnEnterCssClass id="IbtnEnter" οnclick="submitForm()">登录</div>
function submitForm(){
var UserCode = $("#UserCode").val();
var UserPwd = $("#UserPwd").val();
var mypwd = $.base64.btoa($.md5(UserPwd).toUpperCase());
var checkUserParams = {
usercode:UserCode,
userpwd:mypwd
};
$.ajax({
url : 'checkUser.asp?mathid='+Math.random(),
type : 'post',
data : checkUserParams,
dataType:'json',//接受数据格式
success : function(data) {
},
failure : function(data) {
}
});
}
request.getParameter("usercode");
request.getParameter("userpwd");
标签:取值,xxx,request,getParameter,var,data
From: https://www.cnblogs.com/zhaostudy/p/16713407.html