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: <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