美文网首页
jsp中form表单提交post请求和get请求servlet时

jsp中form表单提交post请求和get请求servlet时

作者: Re_一晌贪欢 | 来源:发表于2019-12-17 23:48 被阅读0次

当使用get请求提交form表单时,请求的参数是不使用"?"拼接的在url地址栏的,否则在使用getparameter(),获取参数为null;


捕获.JPG

解决方案:参数可以使用隐藏域在请求体中携带;
<form action="CodeServlet?" >
<input type="text" name="phone_no" >
<input type="hidden" name="method" value="codeSend">
</form>

相关文章