Java-jsp the built-in object request to get all the parameter names

Source: Internet
Author: User
Tags java web

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

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.