request.getParameter()方法

request.getParameter()方法:

  • 获取通过http协议提交过来的数据.。通过容器的实现来取得通过get或者post方式提交过来的数据

  • request.getParameter()方法传递的数据,会从web客户端传到web服务器端,代表HTTP请求数据,该方法返回String类型的数据

相比前者:
request.setAttribute()getAttribute() 只是在web容器内部流转,仅仅是请求处理阶段。

request.getAttribute()方法:返回request范围内存在的对象

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

HttpServletRequest 类有 setAttribute() 方法,而没有setParameter() 方法

一般通过表单链接传递的参数使用getParameter

————————————————

原文链接:https://blog.csdn.net/wodegeekworld/article/details/41870123