JSP table single handle//jsp form receive

Source: Internet
Author: User

Form form Submission

action= "" in quotation marks, which ===> action= "do_post.jsp" submits the data to another file

<%@ Page Language="Java"ContentType="text/html; Charset=utf-8"pageencoding="Utf-8"%><!DOCTYPE HTML PUBLIC "-//w3c//dtd HTML 4.01 transitional//en" "Http://www.w3.org/TR/html4/loose.dtd "><HTML><Head><Metahttp-equiv= "Content-type"content= "text/html; charset=utf-8"><title>Insert Title here</title></Head><Body><formAction= "do_post.jsp"Method= "POST" >User name:<inputtype= "text"ID=""name= "User"><BR>//name= "", when received will be based on the value of namePassword:&nbsp;<inputtype= "Password"ID=""name= "Pass"><BR>Gender:<BR>male<inputtype= "Radio"ID=""value= "Nan"name= "Sex">//value= "", value if not written, receive will only return on (indicates clicked)
female<inputtype= "Radio"ID=""value= "NV"name= "Sex"><BR>Interest:<BR> <inputtype= "checkbox"ID=""name= "Xing"value= "Qixing">Riding the line<inputtype= "checkbox"ID=""name= "Xing"value= "Paoshan">Climbing<inputtype= "checkbox"ID=""name= "Xing"value= "Youyong">Swimming<inputtype= "checkbox"ID=""name= "Xing"value= "Bengji">Bungee Jumping<BR><BR>Personal Description:<BR> <textarearows= "4"cols= "+"name= "Duo"></textarea><BR> <Buttontype= "Submit">Submit</Button></form></Body></HTML>

Get the following interface:

After clicking Submit, it will be submitted to the address in action= ""

<%@ Page Language="Java"ContentType="text/html; Charset=utf-8"pageencoding="Utf-8"%><!DOCTYPE HTML PUBLIC "-//w3c//dtd HTML 4.01 transitional//en" "Http://www.w3.org/TR/html4/loose.dtd "><HTML><Head><Metahttp-equiv= "Content-type"content= "text/html; charset=utf-8"><title>Insert Title here</title></Head><Body><%StringSRT=Request.getparameter ("User"); With the value of name in the form, you get the data Request.setattribute ("US", SRT); //StringPass=Request.getparameter ("Pass"); Request.setattribute ("Pass", pass);StringSex=Request.getparameter ("Sex"); Request.setattribute ("Sex", sex);Stringxing[]=Request.getparametervalues ("Xing"); Multi-box is to receive multiple data, with Getparametervalues, will return an array, with an array to receive Request.setattribute ("Xing", Xing);StringDuo=Request.getparameter ("Duo"); Request.setattribute ("Duo", duo);%><P>${us}</P><P>${pass}</P><P>${sex}</P><% for(Stringx:xing) {//In the Output check box content, loop through%><BR><%=x%><% }%><P>${duo}</P></Body></HTML>

The following results are obtained

JSP table single handle//jsp form receive

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.