<%--提交页面input.jsp--%> <%@ page language="java" import="java.util.*" pageEncoding="utf-8"%> <html> <head> <title>输入页面</title> </head> <request.setCharacterEncoding("UTF-8");> <body> <request.setCharacterEncoding("UTF-8");> <form action="receive2.jsp"method="post"> <table> <tr><td>姓名:</td><td><input name="rdname"></td></tr> <tr><td>电话:</td><td><input name="phname"></td></tr> <tr><td colspan="2"align="center"><input type="submit"value="提交"></td></tr> </table> </form> </body> </html> <%--接收页面示例1 receive.1--%> <%@ page language="java" import="java.util.*" pageEncoding="utf-8"%> <html> <head> <title>接收页面</title> </head> <body> <%request.setCharacterEncoding("UTF-8");%> <% String str1=request.getParameter("rdname"); String str2=request.getParameter("phname"); %> <font face="楷体"size="4"color="blue"> <b>您输入的信息为:<br></b> 姓名:<%=str1 %><br> 电话:<%=str2 %><br> </font> </body> </html> <%--接收页面示例2 receive.2--%> <%@ page language="java" import="java.util.*" pageEncoding="utf-8"%> <html> <head> <title>接收页面2</title> </head> <body> <% String current_param=""; String current_valu=""; request.setCharacterEncoding("utf-8"); Enumeration params=request.getParameterNames(); while(params.hasMoreElements()){ current_param=(String)params.nextElement(); current_valu=request.getParameter(current_param); %>参数名称:<%=current_param %>参数值:<%=current_valu %><br> <% } %> </body> </html>
时间: 2024-10-29 06:23:28