<form action="servlet/thirdservlet?username=1&password=2"Method="Post">name<input type="text"Name="Uesrname"><br>Password<input type="text"Name="PassWord"><br> <input type="Submit"Value="Submit"> </form>
<form action= "servlet/thirdservlet?username=1&password=2" method= "POST" >name<input type= "text" name= "Uesrname" ><br>Password<input type= "text" name= "PassWord" ><br> <input type= "Submit" value= "Submit" > </form> Public voidDoPost (httpservletrequest request, httpservletresponse response)throwsservletexception, IOException {String userName= Request.getparameter ("UserName"); String PassWord= Request.getparameter ("PassWord"); Response.getwriter (). println ("UserName--->" +userName); Response.getwriter (). println ("PassWord---->" +PassWord); }
&NBSP; the difference between get and post in form submission is 5 points 1.get is the data that is fetched from the server, and post is the data that is sent to the server. 2.get is to add the parameter data queue to the URL that the Action property of the submission form refers to, and the value corresponds to the field one by one in the form, as seen in the URL. Post is the httppost mechanism by which the fields within the form are placed within the HTML header with their contents and routed to the URL address referred to by the Action property. The user does not see the process. 3. For Get mode, The server side uses Request.QueryString to get the value of the variable, and for post, the server uses Request.Form to get the submitted data. 4.get the amount of data transferred is small and cannot be greater than 2KB. Post transmits a large amount of data, which is generally not restricted by default. In theory, however, the maximum amount of IIS4 is 100KB in 80KB,IIS5. 5.get security is very low and post security is high. |
Problem with get \post passing parameters in form action