• form action中get post传递参数的问题


    <form action="servlet/ThirdServlet?userName=1&passWord=2" method="post">  
            姓名<input type="text" name="uesrName"><br>  
            密码<input type="text" name="passWord"><br>  
            <input type="submit" value="提交">  
    </form>  
    <form action="servlet/ThirdServlet?userName=1&passWord=2" method="post">  
    
            姓名<input type="text" name="uesrName"><br>  
    
            密码<input type="text" name="passWord"><br>  
    
            <input type="submit" value="提交">  
    
    </form>  
    
    
    
    
    
    public void doPost(HttpServletRequest request, HttpServletResponse response)  
    
                throws ServletException, IOException {  
    
            String userName = request.getParameter("userName");  
    
            String passWord = request.getParameter("passWord");  
    
            response.getWriter().println("userName --->"+userName);  
    
            response.getWriter().println("passWord---->"+passWord);  
    
    } 
    当form提交方式为get的时候,组件里填写了value的值,action里的url后也带有参数(写死的),这时servlet获取的uesrName和passWord是文本组件里的值

    当form提交方式为post的时候,组件里填写了value的值,action里的url后也带有参数(写死的),这时servlet获取的uesrName和passWord是url后参数的值
     
    表单提交中Get和Post方式的区别有5点

    1.get是从服务器上获取数据,post是向服务器传送数据。

    2.get是把参数数据队列加到提交表单的ACTION属性所指的URL中,值和表单内各个字段一一对应,在URL中可以看到。post是通过HTTPpost机制,将表单内各个字段与其内容放置在HTML HEADER内一起传送到ACTION属性所指的URL地址。用户看不到这个过程。
    3.对于get方式,服务器端用Request.QueryString获取变量的值,对于post方式,服务器端用Request.Form获取提交的数据。
    4.get传送的数据量较小,不能大于2KB。post传送的数据量较大,一般被默认为不受限制。但理论上,IIS4中最大量为80KB,IIS5中为100KB。
    5.get安全性非常低,post安全性较高。
  • 相关阅读:
    ubuntu python opencv3 cv2.cv2 has no attribute 'face' 'cv2.face' has no attribute 'createEigenFaceRecognizer'
    python opencv3 摄像头人脸检测
    python opencv3 静态图片检测人脸
    python opencv3 grabcut前景检测
    python opencv3 圆检测
    python opencv3 直线检测
    lua--clone
    LoadingController
    粒子加到骨骼中
    CCShatteredTiles3D
  • 原文地址:https://www.cnblogs.com/gwq369/p/5602626.html
Copyright © 2020-2023  润新知