开发者

How to interpolate java expressions in struts attribute strings

开发者 https://www.devze.com 2023-01-22 07:06 出处:网络
I have the following: <html:select property=\"myMap(abc)\"> What I really need to do, however, is pull the string abc from a staticmember of a java class.

I have the following:

<html:select property="myMap(abc)">

What I really need to do, however, is pull the string abc from a static member of a java class.

I thought something like

&l开发者_如何学运维t;html:select property="myMap(<%=MyClass.FIELD%>)"> , but that didn't work.

What's the correct syntax here?


Try the following:

<% String name = "myMap(" + MyClass.FIELD + ")"; %>
<html:select property="<%=name%>">
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号