Java-jsp the request of the built-in object gets the parameter value of the parameter (a value)

Source: Internet
Author: User
Tags java web

Related information:
"21-Day Learning Java Web Development"

Get parameter values for parameters (one value)


requestform3.jsp

1 <%@ Page Language="Java"ContentType="text/html;charset=gb2312" %>2 <HTML>3 <Head>4   <title>Form</title>5 </Head>6 <Body>7   <formAction= "requestdemo3.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

requestdemo3.jsp

1 <%@ Page Language="Java"ContentType="text/html;charset=gb2312"Import="java.util.*" %>2 <HTML>3 <Head>4   <title>Use the Request object to get parameter values for all parameters</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       Stringstrrequest=request.getparameter (str);//get parameter values for corresponding parameters - out.println (str+"the parameter values are:"+strrequest+"<br>");//Print output parameter names and parameter values -     } the   %> - </Body> - </HTML>
View Code

Java-jsp the request of the built-in object gets the parameter value of the parameter (a value)

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.