Form form Forms common submission method-get and Post differences

Source: Internet
Author: User

There are two ways to submit your form: Get and post

<form name= "RegForm" action= "action" method= "Submission method" ></form>

1. Get

Data is submitted in clear text through a URL, and the data is visible in the URL. Submit data can not exceed 2kb, security is lower, but the efficiency is higher than post. It is suitable to submit data with less security, such as search, query and other functions.

2. Post

The information submitted by users is encapsulated in the HTML header, which is suitable for user information with high data volume and security. such as registration, modification, upload and other functions.

Example: login.jsp

<%@ Page Language="Java"Import="java.util.*"ContentType="text/html; Charset=utf-8" %><%StringPath=Request.getcontextpath ();StringBasePath=Request.getscheme ()+"://"+Request.getservername ()+":"+Request.getserverport ()+Path+"/";%><!DOCTYPE HTML PUBLIC "-//w3c//dtd HTML 4.01 transitional//en"><HTML>  <Head>    <Basehref= "<%=basePath%>">        <title>My JSP ' login.jsp ' starting page</title>        <Metahttp-equiv= "Pragma"content= "No-cache">    <Metahttp-equiv= "Cache-control"content= "No-cache">    <Metahttp-equiv= "Expires"content= "0">        <Metahttp-equiv= "keywords"content= "Keyword1,keyword2,keyword3">    <Metahttp-equiv= "description"content= "This is my page">    <!--<link rel= "stylesheet" type= "Text/css " href= "Styles.css" > -  </Head>    <Body>    <H1>User Login</H1>    <HR>    <formAction= "dologin.jsp"name= "LoginForm"Method= "POST">     <Table>       <TR>         <TD>User name:</TD>         <TD><inputtype= "text"name= "username"/></TD>       </TR>       <TR>         <TD>Password:</TD>         <TD><inputtype= "Password"name= "Password"/></TD>       </TR>       <TR>         <TDcolspan= "2"><inputtype= "Submit"value= "Login"></TD>       </TR>     </Table>    </form>  </Body></HTML> 

Form form Forms common submission method-get and Post differences

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.