[英]Struts2 - JSP EL - Concatenation doesn't seem to work
Trying to figure out this issue for a long time... 试图找出这个问题很长一段时间......
I am setting a variable with a value from an Object. 我正在使用Object中的值设置变量。
<s:set name="bodyText" value='First Name "myObject.name"'/>
and trying to print it in the following ways.. None of these works. 并尝试以下列方式打印它们。这些都不起作用。
"${bodyText}"
"<s:property value="#bodyText" />"
"${#bodyText}"
"%{bodyText}"
"%{#bodyText}"
Not sure the problem is with 不确定问题是什么
I tried the following as well: 我也尝试了以下内容:
<s:set name="bodyText" value='First Name "${myObject.name}"'/>
But it did not work. 但它没有用。
The value attribute should be an object. value属性应该是一个对象。 OGNL uses quotes to delimit a string object, other quotes should be escaped.
OGNL使用引号来分隔字符串对象,其他引号应该被转义。
And use var
attribute for variable name. 并使用
var
属性作为变量名。
<s:set var="bodyText" value="'First Name \"myObject.name\"'"/>
<s:property value="bodyText" />
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.