`
flashdream8
  • 浏览: 668334 次
  • 性别: Icon_minigender_1
  • 来自: 北京
社区版块
存档分类
最新评论

Struts1.2 中配置文件中的Action的attribute属性起什么作用

阅读更多

      在一般情况下,actionForm是被存储在一定的scope中(request或session,通过action的scope属性来配置),当我们在配置时,指定name而不指定attribute,那么指定的name值就作为actionForm存储在scope中的key值,我们可以在action中通过httpServletRequest.getAttribute("指定的name属性值")来获得这个actionForm;   当我们既配置了name又配置了attribute,那么actionForm存储在scope中的key值就采用attribute属性指定的值了,这时要通过httpServletRequest.getAttribute("指定的attribute属性值")来获得actionForm,此时通过httpServletRequest.getAttribute("指定的name属性值")是不能获得actionForm的。 
  
  所以,是否配置attribute属性就决定了actionForm存储在scope中的key值是采用name,还是采用attribute

 

 

转自:http://www.diybl.com/course/3_program/java/javajs/2008315/104661.html

分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics