Related information:
"21-Day Learning Java Web Development"
Get all the parameter names
The Getparameternames () method of the 1.request object can get all the parameter names.
requestform2.jsp
1 <%@ Page Language="Java"ContentType="text/html;charset=gb2312" %>2 <HTML>3 <Head>4 <title>Form</title>5 </Head>6 <Body>7 <formAction= "requestdemo2.jsp"Method= "POST">8User name:<inputtype= "text"name= "username"/><BR>9User password:<inputtype= "Password"name= "UserPassword"/>Ten <inputtype= "Submit"value= "Submit"> One </form> A </Body> - </HTML>
View Code
requestdemo2.jsp
1 <%@ Page Language="Java"ContentType="text/html;charset=gb2312"Import="java.util.*" %>2 <HTML>3 <Head>4 <title>Get all parameter names using the Request object</title>5 </Head>6 <Body>7 <%--through the getparameternames of the request object--%> 8 <% 9 Enumeration<String>e=request.getparameternames ();//get all the parameter namesTen while(E.hasmoreelements ()) {//Traverse Enumeration One StringStr= (String) e.nextelement (); //Take out the next element value A out.println (str);//Print output variable name - } - %> the </Body> - </HTML>
View Code
Java-jsp the built-in object request to get all the parameter names