首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 网站开发 > Web前端 >

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

2012-10-24 
Struts1.2 中配置文件中的Action的attribute属性起什么作用????? 在一般情况下,actionForm是被存储在一定

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

热点排行