我想通过使用 Struts2 属性标记 <s:property value="id"/>
获取操作类中的属性值并将其赋予另一个标签,如下所示(错误的代码,只是为了给出想法):
<t:tag id="<s:property value="id"/>"/>
我该怎么做?
注:<t:
映射到自定义标记库。
最佳答案
你不能像这样嵌套(服务器端)标签;
如果您不知道自己在做什么,我建议您坚持使用现有的标记库,standing on the shoulders of the giants ;如果您要继承它并且无法删除它,请尝试使用 JSP EL 语法:
<t:tag id="${id}"/>
(值堆栈中的对象可通过 Struts2 请求包装器提供给 JSP EL)
关于jsp - 如何注入(inject)Struts <s :property/> tag into another tag的值,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30982031/