《JSP完全学习手册》学习心得:request.getParameterValues()
sendParameter.jsp:
<form method="post" action="getParameter.jsp">
<input type="checkbox" name="name" />中国
<input type="checkbox" name="sex" />sex
<select name ="style" multiple="true">
<option value="FreeStyle"/>FreeStyle
<option value="GeneralStyle">GeneralStyle
</select>
<input type="submit" value = "提交"/>
</form>
getParameter.jsp:
<%@page contentType="text/html;charset=GB2312" language="java"%>
<%@page import="java.util.Enumeration"%>
JSP显示所有参数:<br />
<%
Enumeration names = request.getParameterNames();
while(names.hasMoreElements()){
String name = (String)names.nextElement();
String[] values = request.getParameterValues(name);
out.print(name + "=");
for(String value : values)
out.print("\"" + value + "\" ");
out.println("<br />");
}
%>
posted on 2009-05-27 23:32
天堂露珠 阅读(573)
评论(0) 编辑 收藏 所属分类:
JSP