列出所有请求表单提交数据的通用jsp脚本,调试可以使用
将代码保存为 showRequestParameters.jsp
只要在处理表单的页面包含该文件即可
<%-- A Jsp Component that Shows Request Parameters
Include this page to view request parameters.
Example Use:
...
<h2>Request Parameters</h2>
<jsp:include page='showRequestParameters.jsp'/>
...
--%>
<%
java.util.Enumeration e = request.getParameterNames();
while(e.hasMoreElements()) {
String name = (String)e.nextElement();
String[] values = request.getParameterValues(name);
for(int i=0; i < values.length; ++i) {
String next = values[i];
if(i == 0) { %>
<b><%= name %>:</b> <%= next %>
<% }
else { %>
, <%= next %>
<% }
} %>
<br>
<% }
%>