zoukankan      html  css  js  c++  java
  • JAVA-JSP内置对象之request获得所有的参数名称

    相关资料:
    《21天学通Java Web开发》

    获得所有的参数名称
    1.request对象的getParameterNames()方法可以获得所有的参数名称。

    RequestForm2.jsp

     1 <%@ page language="java" contentType="text/html;charset=gb2312" %>
     2 <html>
     3 <head>
     4   <title>表单</title>
     5 </head>
     6 <body>
     7   <form action="RequestDemo2.jsp" method="post">
     8     用户名:<input type= "text" name="username"/><br>
     9     用户密码:<input type= "password" name="userpassword"/>
    10     <input type="submit" value="提交">
    11   </form>
    12 </body>
    13 </html>
    View Code

    RequestDemo2.jsp

     1 <%@ page language="java" contentType="text/html;charset=gb2312" import="java.util.*" %>
     2 <html>
     3 <head>
     4   <title>使用request对象获得所有的参数名称</title>
     5 </head>
     6 <body>
     7   <%-- 通过request对象的getParameterNames --%>  
     8   <% 
     9     Enumeration<String> e = request.getParameterNames();//获得所有的参数名称
    10     while(e.hasMoreElements()){  //遍历Enumeration
    11       String str = (String)e.nextElement(); //取出下一个元素值
    12       out.println(str);//打印输出变量名称
    13     }
    14   %>
    15 </body>
    16 </html>
    View Code
  • 相关阅读:
    Win10 蓝屏
    XE Button Color
    IOS 屏幕尺寸
    Delphi 转圈 原型进度条 AniIndicator 及线程配合使用
    Delphi 询问框 汉化
    Delphi Android 询问框
    Delphi BLE 控件
    浮点高低位赋值
    delphi 蓝牙 TBluetoothLE
    16进制字节转换
  • 原文地址:https://www.cnblogs.com/FKdelphi/p/7669953.html
Copyright © 2011-2022 走看看