Get Form Parameter Enumeration : Form Post « JSP « Java Tutorial






index.jsp

<HTML>
    <HEAD>
        <TITLE>Getting Parameter Names</TITLE>
    </HEAD>
 
    <BODY>
        <H1>Getting Parameter Names<H1>
        <FORM ACTION="basic.jsp" METHOD="POST">
            <INPUT TYPE="TEXT" NAME="text1">
            <BR>
            <SELECT NAME="select1" SIZE="5" MULTIPLE>
                <OPTION>Option 1</OPTION>
                <OPTION selected>Option 2</OPTION>
                <OPTION>Option 3</OPTION>
                <OPTION>Option 4</OPTION>
                <OPTION>Option 5</OPTION>
            </SELECT>
            <BR>
            <INPUT TYPE="SUBMIT" VALUE="Submit">
        </FORM>
    </BODY>
</HTML>

basic.jsp

<HTML>
    <HEAD>
        <TITLE>Reading Parameter Names</TITLE>
    </HEAD>

    <BODY>
        <H1>Reading Parameter Names</H1>
        Parameter Names:
        <BR>
        <% java.util.Enumeration names = request.getParameterNames();
        while(names.hasMoreElements()){
            out.println(names.nextElement() + "<BR>");
        }
        %>
    </BODY>
</HTML>
  Download:  GetFormParameterEnumeration.zip( 1 k)








23.26.Form Post
23.26.1.Get Form Parameter Enumeration
23.26.2.Get Form Parameter By Index
23.26.3.Form Calculator
23.26.4.Process the Form action in the save page
23.26.5.Use multiple forms
23.26.6.Get submit button value