getParameter和getAttribute的区别是什么?_getattribute和getparameter有什么区别-程序员宅基地

技术标签: string  null  servlets  attributes  parameters  object  

楼主xxmm(晓箫)2001-07-22 21:18:05 在 Java / Web 开发 提问

问题点数:20、回复次数:5Top

src="/Include/Board.htm?Tags=null,getattribute,getparameter,参数,lang,getparametervalues,attribute,parameters,request,exist" frameborder="0" scrolling="no">

1 楼yelz(断弦)回复于 2001-07-22 21:55:46 得分 8

getParameter   返回上个页面提交得参数,getAttribute返回系统属性,不同jsp服务器可能不同。Top

2 楼xxmm(晓箫)回复于 2001-07-22 22:10:33 得分 0

系统属性指什么?能不能给一个例子?Top

3 楼muwenyi(咔咔)回复于 2002-02-10 13:17:46 得分 8

getParameter可以获得客户端传送给服务器端的参数值。  
   
  getAttribute可以得到由setAttribute设置的参数值,就相当于是使用getAttribute得到一个自己定义的参数,而不是从客户端得到的参数。我是这样理解的!Top

4 楼gzwrj(我无知,所以我有智慧.)回复于 2002-02-11 12:31:38 得分 2

getAttribute  
  public   java.lang.Object   getAttribute(java.lang.String   name)  
  Returns   the   value   of   the   named   attribute   as   an   Object,   or   null   if   no   attribute   of   the   given   name   exists.    
  Attributes   can   be   set   two   ways.   The   servlet   container   may   set   attributes   to   make   available   custom   information   about   a   request.   For   example,   for   requests   made   using   HTTPS,   the   attribute   javax.servlet.request.X509Certificate   can   be   used   to   retrieve   information   on   the   certificate   of   the   client.   Attributes   can   also   be   set   programatically   using   setAttribute(java.lang.String,   java.lang.Object).   This   allows   information   to   be   embedded   into   a   request   before   a   RequestDispatcher   call.    
   
  Attribute   names   should   follow   the   same   conventions   as   package   names.   This   specification   reserves   names   matching   java.*,   javax.*,   and   sun.*.  
   
  Parameters:  
  name   -   a   String   specifying   the   name   of   the   attribute  
  Returns:  
  an   Object   containing   the   value   of   the   attribute,   or   null   if   the   attribute   does   not   exist  
   
  //  
  getParameter  
  public   java.lang.String   getParameter(java.lang.String   name)  
  Returns   the   value   of   a   request   parameter   as   a   String,   or   null   if   the   parameter   does   not   exist.   Request   parameters   are   extra   information   sent   with   the   request.   For   HTTP   servlets,   parameters   are   contained   in   the   query   string   or   posted   form   data.    
  You   should   only   use   this   method   when   you   are   sure   the   parameter   has   only   one   value.   If   the   parameter   might   have   more   than   one   value,   use   getParameterValues(java.lang.String).    
   
  If   you   use   this   method   with   a   multivalued   parameter,   the   value   returned   is   equal   to   the   first   value   in   the   array   returned   by   getParameterValues.    
   
  If   the   parameter   data   was   sent   in   the   request   body,   such   as   occurs   with   an   HTTP   POST   request,   then   reading   the   body   directly   via   getInputStream()   or   getReader()   can   interfere   with   the   execution   of   this   method.  
   
  Parameters:  
  name   -   a   String   specifying   the   name   of   the   parameter  
  Returns:  
  a   String   representing   the   single   value   of   the   parameter  
  See   Also:    
  getParameterValues(java.lang.String)  
  Top

5 楼armyshu(~!@#$%^&*)回复于 2002-02-19 11:41:06 得分 2

getParameter只能传递string类型的变量,getAttribute能传递vector! 

版权声明:本文为博主原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。
本文链接:https://blog.csdn.net/stupidwu/article/details/1502728

智能推荐

React TypeScript中tsx文件报红_react+ts 项目 文件提示红色-程序员宅基地

文章浏览阅读888次。【代码】React TypeScript中tsx文件报红。_react+ts 项目 文件提示红色

ubuntu 出现“E: 无法定位软件包问题”解决方法_e: 无法定位软件包 x11proto-print-dev-程序员宅基地

文章浏览阅读5.1k次,点赞2次,收藏21次。解决 Ubuntu E:无法定位软件包问题-程序员宅基地。_e: 无法定位软件包 x11proto-print-dev

从O到1:YOLOV5训练自己的目标检测数据集,并使用C++部署,python部署,树莓派等等。_c++深度学习构建数据集实现目标检测-程序员宅基地

文章浏览阅读1.6k次,点赞20次,收藏24次。从O到1:YOLOV5训练自己的目标检测数据集。_c++深度学习构建数据集实现目标检测

【DL小结4】seq2seq与attention机制_seq2seq模型是以编码(encode)和解码(decode)为代表的架构方式,seq2seq模型-程序员宅基地

文章浏览阅读1.1k次。seq2seq概述seq2seq模型是以编码(Encode)和解码(Decode)为代表的架构方式,顾名思义是根据输入序列X来生成输出序列Y。encode意思是将输入序列转化成一个固定长度的向量(语义向量,context vector),decode意思是将语义向量解码成输出序列。编码阶段纯粹的RNN/LSTM/GRU解码阶段由上图可以发现Seq2seq中Decoder的公式和..._seq2seq模型是以编码(encode)和解码(decode)为代表的架构方式,seq2seq模型是根据

智能合约最佳实践 之 Solidity 编码规范_智能合约代码规范-程序员宅基地

文章浏览阅读1.5k次,点赞2次,收藏4次。每一门语言都有其相应的编码规范, Solidity 也一样, 下面官方推荐的规范及我的总结,供大家参考,希望可以帮助大家写出更好规范的智能合约。命名规范避免使用小写的l,大写的I,大写的O 应该避免在命名中单独出现,因为很容易产生混淆。合约、库、事件、枚举及结构体命名合约、库、事件及结构体命名应该使用单词首字母大写的方式,这个方式也称为:帕斯卡命名法或大驼峰式命名法..._智能合约代码规范

2021-06-21 VC++ 6.0安装_bv1yb411t7e8-程序员宅基地

文章浏览阅读1.1k次。2021-06-21 VC++ 6.0安装前言本次实验所用设备为微软surface pro4,操作系统为windows10。注意事项(1)前端编程注意HTML语言的灵活运用以及javascript语言的使用。(2)所要使用图片自己上网寻找替换即可。(3)由于涉及隐私问题,所以代码实现效果图没有全部放出来。(4)本文章主要用于大家学习参考,博客中代码按照步骤来即可执行使用,但请不要商用。。(5)本次安装参照B站视频完成,视频网址如下:https://www.bilibili.com/vi._bv1yb411t7e8

随便推点

编译器_cx51 编译原理-程序员宅基地

文章浏览阅读64次。编译器不是全智能的,有些错误不会立刻呈现1:编译错误,语法问题2:运行时出错,异常,崩溃,运行出错提示不在出错代码时,在之后。_cx51 编译原理

图解 SpringCloud 微服务架构,写的太好了!-程序员宅基地

文章浏览阅读158次。????这是一个或许对你有用的社群????一对一交流/面试小册/简历优化/求职解惑,欢迎加入「芋道快速开发平台」知识星球。下面是星球提供的部分资料:《项目实战(视频)》:从书中学,往事中“练”《互联网高频面试题》:面朝简历学习,春暖花开《架构 x 系统设计》:摧枯拉朽,掌控面试高频场景题《精进 Java 学习指南》:系统学习,互联网主流技术栈《必读 Java 源码专栏》:知其然,知其所以然????这是一个或许..._springboot spring cloud nacos 微服务架构图

keytool 错误: java.lang.Exception: 密钥库文件不存在: keystore_keytool 错误: java.lang.exception: 密钥库文件不存在: jone.ke-程序员宅基地

文章浏览阅读8.9k次,点赞3次,收藏6次。keytool 错误: java.lang.Exception: 密钥库文件不存在: keystore通过Android Studio编译器获取SHA1第一步、打开Android Studio的Terminal工具第二步、输入命令:keytool -v -list -keystore keystore文件路径,然后提示keytool 错误: java.lang.Exception:..._keytool 错误: java.lang.exception: 密钥库文件不存在: jone.keystore java.lang

使用conda命令出现:The environment is inconsistent, please check the package plan carefully解决办法-程序员宅基地

文章浏览阅读5.8k次,点赞2次,收藏8次。使用conda命令时出现下面报错只需要两条命令即可解决一.查询之前的更新版本,然后选择一个之前的版本(出现问题之前)conda list -r二.输入下面命令回滚到之前没出错的版本conda install --revision 版本数字例如输入conda install --revision 143..._the environment is inconsistent

[附源码]Python计算机毕业设计SSM健身俱乐部管理系统(程序+LW)_基于python的健身管理系统-程序员宅基地

文章浏览阅读507次。项目运行环境配置:Jdk1.8 + Tomcat7.0 + Mysql + HBuilderX(Webstorm也行)+ Eclispe(IntelliJ IDEA,Eclispe,MyEclispe,Sts都支持)。项目技术:SSM + mybatis + Maven + Vue 等等组成,B/S模式 + Maven管理等等。环境需要1.运行环境:最好是java jdk 1.8,我们在这个平台上运行的。其他版本理论上也可以。2.IDE环境:IDEA,Eclipse,Myeclipse都可以。推荐IDEA;_基于python的健身管理系统

Github Desktop1:git的优点和github desktop的简单使用_githubdesktop-程序员宅基地

文章浏览阅读4.4k次,点赞4次,收藏15次。多人合作一个项目,一定要把代码放到一个地方,并随时同步自己本地的和公共的代码。我们也曾这么做,租用一台服务器,修改完本地的代码就复制到服务器上,而开始编写前把服务器上的复制到本地。然而这样做有以下缺点:1.麻烦。就算用ftp软件同步文件,选择文件并复制也很繁琐。2.缺乏更新信息的交流。对代码进行修改,却不说明这次修改了哪些部分,没有更新日志,这将造成开发者对项目的严重误读,而传统的更新日志方..._githubdesktop

推荐文章

热门文章

相关标签