• request.getParameter() 和request.getAttribute() 区别


    getParameter 是用来接受用post个get方法传递过来的参数的.
    getAttribute 必须先setAttribute.

    request.getParameter()
    request.getParameter() 取得是通过容器的实现来取得通过类似post,get等方式传入的数据,request.setAttribute()和getAttribute()只是在web容器内部流转,仅仅是请求处理阶段。
    request.getParameter() 方法传递的数据,会从Web客户端传到Web服务器端,代表HTTP请求数据。request.getParameter()方法返回String类型的数据。

    request.getAttribute()
    request.setAttribute() 和 getAttribute() 方法传递的数据只会存在于Web容器内部

    还有一点就是,HttpServletRequest 类有 setAttribute() 方法,而没有setParameter() 方法。

    详情参看此博

    https://blog.csdn.net/zhaohongjuan/article/details/53641160?ticket=ST-466600-QjV6fOMxPaG2ypNz5pHe-passport.csdn.net
    ---------------------
    作者:neonism
    来源:CSDN
    原文:https://blog.csdn.net/neonism/article/details/82112943
    版权声明:本文为博主原创文章,转载请附上博文链接!

  • 相关阅读:
    log输出到日志和控制台
    CRM--搜索功能
    CRM--对数据进行排序
    CRM-注意的小事情
    CRM--modelform之instance
    CRM--保留原搜索条件
    crm系统
    Django多个app情况下静态文件的配置
    测试
    题库
  • 原文地址:https://www.cnblogs.com/Jeely/p/10856949.html
Copyright © 2020-2023  润新知