【发布时间】:2015-05-04 17:06:06
【问题描述】:
我想使用 Struts1 中的逻辑标记来比较两个独立 bean 的属性:
<logic:equal name="beanOne" property="beanOneProperty"
value="<bean:write name="beanTwo" property="beanTwoProperty" />">
//code to execute
</logic:equal>
但是上面的代码导致如下错误信息:
无法找到标记属性 beanTwo 的标记属性信息。
如何将 value 属性分配为存储在第二个 bean 中的内容?
还有比这更简洁的解决方案吗?
<bean:define id="beanTwoProperty" scope="request">
<bean:write name="beanTwo" property="propOne"/>
</bean:define>
<logic:equal name="beanOne" property="beanOneProperty" value="<%=beanTwoProperty">
我的问题与this one 重复,但我很想看看是否有纯Struts-1 解决方案可用。
【问题讨论】:
-
您可以使用 Struts 1 标签的 EL 版本,但是……当您不需要使用 Struts 标签时,不要使用。 EL 标签只是复制了你的容器提供的开箱即用的功能——它们是在 EL 无处不在之前编写的。
标签: struts-1