request.getParameter(“xxx”)的参数的取值
2019-01-07 21:09 GarfieldEr007 阅读(489) 评论(0) 编辑 收藏 举报request.getParameter(“xxx”)的参数的取值的几种可能:
1. 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”);
2. 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”);
3. Html中url的内容
<a href="SortServlet?flag=5&temp=2" onclick="sort()"><img src="images/cbsj.jpg" /></a>
request.getParameter(“flag”);
request.getParameter(“temp”);
4. Ajax中的data
<form name="fm" 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" onclick="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");
---------------------
作者:BIRD_A_Code
来源:CSDN
原文:https://blog.csdn.net/BIRD_A_JAVA/article/details/80367805
版权声明:本文为博主原创文章,转载请附上博文链接!