Struts2 Tag 标签

struts2 OGNL 中的#、%等符号的区别:
Apache Struts 2 Documentation -> OGNL:
http://struts.apache.org/2.2.3/docs/ognl.html
Apache Struts 2 Documentation -> Tag Syntax:
http://struts.apache.org/2.2.3/docs/tag-syntax.html
Struts 2: %{} or # :
http://www.coderanch.com/t/420711/Struts/Struts-or
Setting the value in <s:textfield from request scope:
http://www.coderanch.com/t/440061/Struts/Setting-value-textfield-request-scope
引用
%{} is the OGNL escape. The # means it's an action context "scope" variable, not on the stack.
Again--there's zero reason to do it like this, and at least a couple reasons not to
.







Js中取struts2标签s:autocompleter的值(版本:2.0.11.1):
<s:autocompleter theme="simple" id="steelgradeIdjh" name="qm.steelgradeId" list="steelgradesNameList" cssClass="textinput" forceValidOption="true" cssStyle="width:80" />
var obj = dojo.widget.byId("steelgradeIdjh");
alert(obj.getValue());






不要在普通html标签中嵌套struts2 ognl表达式。如这样的写法是错误的:
<input  type="text"  name="fidsDispTempdataList[%{#stas.index}].pages" id="fidsDispTempdataList[%{#stas.index}].pages" size="4">

正确的应该是:
<s:textfield id="fidsDispTempdataList[%{#stas.index}].pages" name="fidsDispTempdataList[%{#stas.index}].pages" theme="simple" value=""></s:textfield>


但是可以在普通html标签中嵌套struts2标签,如:
<input  type="text" name="fidsDispTemplate.code" id="fidsDispTemplate.code" value="<s:property value="fidsDispTemplate.code"/>" />

猜你喜欢

转载自wuaner.iteye.com/blog/1027907