struts2 OGNL 中的#、%等符号的区别:
Apache Struts 2 Documentation -> OGNL:
[url]http://struts.apache.org/2.2.3/docs/ognl.html[/url]
Apache Struts 2 Documentation -> Tag Syntax:
[url]http://struts.apache.org/2.2.3/docs/tag-syntax.html[/url]
Struts 2: %{} or # :
[url]http://www.coderanch.com/t/420711/Struts/Struts-or[/url]
Setting the value in <s:textfield from request scope:
[url]http://www.coderanch.com/t/440061/Struts/Setting-value-textfield-request-scope[/url][quote][b]%{} 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[/b].[/quote]
Js中取struts2标签s:autocompleter的值(版本:2.0.11.1):
不要在普通html标签中嵌套struts2 ognl表达式。如这样的写法是错误的:
正确的应该是:
但是可以在普通html标签中嵌套struts2标签,如:
Apache Struts 2 Documentation -> OGNL:
[url]http://struts.apache.org/2.2.3/docs/ognl.html[/url]
Apache Struts 2 Documentation -> Tag Syntax:
[url]http://struts.apache.org/2.2.3/docs/tag-syntax.html[/url]
Struts 2: %{} or # :
[url]http://www.coderanch.com/t/420711/Struts/Struts-or[/url]
Setting the value in <s:textfield from request scope:
[url]http://www.coderanch.com/t/440061/Struts/Setting-value-textfield-request-scope[/url][quote][b]%{} 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[/b].[/quote]
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"/>" />