码迷,mamicode.com
首页 > Web开发 > 详细

在jsp中用EL 表达来获取表单中的参数

时间:2016-07-11 18:49:13      阅读:183      评论:0      收藏:0      [点我收藏+]

标签:

 在一个JSP页面转到另一个JSP页面时,对表单中的参数用EL表达式提取为:
 
 
<form action="sampleJsp.jsp" method="post"> 
    <input type="text" name="sampleValue" value="10" /> 
    <input type="text" name="sampleValue" value="11" /> 
    <input type="text" name="sampleValue" value="12" /> 
    <input type="text" name="sampleSingleValue" value="SingleValue"/> 
    <input type="submit" value="提交"/> 
   </form> 

xx.jsp 的 <body>中    有 

    ${paramValues.sampleValue[2]} 
    ${param.sampleSingleValue } 

显示结果为12 SingleValue 

第一个EL表达就相当于在servlet中使用request.getParameterValues("sampleValue"); 

第二个EL表达式就相当于在servlet中使用request.getParameter("sampleSingleValue"); 

 

在jsp中用EL 表达来获取表单中的参数

标签:

原文地址:http://www.cnblogs.com/beijingstruggle/p/5661020.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!