gpt4 book ai didi

java - 嵌套 <嵌套 :equal> and in combination

转载 作者:行者123 更新时间:2023-11-29 09:00:47 33 4
gpt4 key购买 nike

基本上,我的问题很简单,但它需要知道 Struts 1.1 并且还活着的人。

我尝试构建的伪代码看起来像这样:

IF element.method1 = true THEN
IF element.method2 = true THEN
COLOR.GREEN, PRINT element.prop1
ELSE
COLOR.RED, PRINT element.prop1
END
ELSE
COLOR.BLACK, PRINT element.prop1
END

整个过程将在一次迭代中发生。所以这里是目前有效但尚未达到目标的方法:

<nested:equal property="method1" value="true">
<nested:write property="prop1" />
</nested:equal>

<nested:notEqual property="method1" value="true">
<nested:write property="prop1" />
</nested:notEqual>

现在真正让我发疯的是这也行得通:

<nested:equal property="method1" value="true">
<nested:equal property="method2" value="true">
</nested:equal>
</nested:equal>

<nested:notEqual property="method1" value="true">
<nested:write property="prop1" />
</nested:notEqual>

但是每当我在两个内部 nested:equal 标签之间插入一些东西时,它就不会编译。

所以我的最终解决方案(见下文)不会编译提示 "Missing Endtag for nested:write."

<nested:equal property="method1" value="true">

<nested:equal property="method2" value="true">
<nested:write property="element.prop1" />
</nested:equal>

</nested:equal>

<nested:notEqual property="method1" value="true">
<nested:write property="element.prop1" />
</nested:notEqual>

大约 4 小时后,我仍然不知道如何管理它,所以任何建议都将不胜感激,甚至在这篇文章发布 2 周后也会有所帮助,因为我的下一步是深入研究 Struts 1.1 文档。

最佳答案

虽然 Roman C 的解决方案工作得很好,但我也设法将它与嵌套标签结合在一起。

不幸的是,我不允许发布原始来源,但这是现在的工作方式及其工作方式:

<nested:form action="/someReq" styleClass="standard">
<nested:present property="myBean.genList">

<nested:iterate property="myBean.genList" indexId="index">

<nested:equal property="method1" value="true">

<nested:equal property="method2" value="true">
<strong class="green">
<nested:write property="prop1" />
</strong>
</nested:equal>

<nested:notEqual property="method2" value="true">
<strong class="red">
<nested:write property="prop1" />
</strong>
</nested:notEqual>

</nested:equal>

<nested:notEqual property="method1" value="true">
<nested:write property="prop1" />
</nested:notEqual>

</nested:iterate>

</nested:present>
</nested:form>

关于java - 嵌套 <嵌套 :equal> and <nested:write> in combination,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17617112/

33 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com