request.getParameter(“xxx”)的参数的取值

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″ οnclick=”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” ο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”);

 

 

 只为学习!!!

转载原路径   https://blog.csdn.net/BIRD_A_JAVA/article/details/80367805

版权声明:本文为chaoesha原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。
本文链接:https://www.cnblogs.com/chaoesha/p/13041381.html