日期:2014-05-19  浏览次数:20702 次

struts2标签、OGNL和EL怎么取属性值包含"."号的值?
比如后台:request.setAttribute("dictionary.testName", "好");
前台如何用struts2标签或者OGNL或者EL表达式如何取得dictionary.testName值。

------解决方案--------------------
${requestScope['dictionary.testName']}或者${requestScope["dictionary.testName"]}
------解决方案--------------------
原来dictionary.testName是字符串啊,呵呵。
你把他存到了stack context中,要这样
从action上下文获得值栈的属性
<s:property value="#request['dictionary.testName']"/>
或者<s:property value="#request.dictionary.testName"/> 

不过这样意义不大,能实现就行了,还是用我在4楼给你写的那种做法比较好。

搞定,给分吧~