简体   繁体   English

包含或索引 <s:property> 标签Struts2?

[英]Contains Or Index of in <s:property> tag Struts2?

I have been looking for use <s:property> in struts2 if condtion...and I found the solution but Contains or IndexOf doesn't works in my case can someone help me on syntax.... 我一直在寻找在struts2中使用<s:property>如果condtion ...我找到了解决方案,但ContainsIndexOf在我的情况下不起作用,有人可以帮我解决语法问题....

<s:iterator value="DirList" status="DirSTS" var="Dir">
    <s:if test="#DetailsStatus.index==#DirSTS.index">
        <s:if test="%{#Dir.indexOf(':'}!= -1">
            <a href='<s:property/>'><small>Click Here </small></a>
        </s:if>                     
    </s:if>
</s:iterator>

Here DetailsStatus is main list status variable...here I want to check if <s:property> have : symbol 这里DetailsS​​tatus是主列表状态变量...这里我想检查<s:property>是否:符号

First thing that your syntax missing ) closing bracket. 你的语法缺少的第一件事就是关闭括号。 Second make sure you have correct values in list which have : Symbol(You have already commented that it have wrong values) 第二,确保列表中的值具有正确的值:符号(您已经评论它有错误的值)

here is your code 这是你的代码

<s:iterator value="DirList" status="DirSTS" var="Dir">
<s:if test="#DetailsStatus.index==#DirSTS.index">
    <s:if test="%{#Dir.indexOf(':'}!= -1">
        <a href='<s:property/>'><small>Click Here </small></a>
    </s:if>                     
</s:if>

change your code to like this .... 把你的代码改成这样 ......

<s:iterator value="DirList" status="DirSTS" var="Dir">
<s:if test="#DetailsStatus.index==#DirSTS.index">
    <s:if test="#Dir.indexOf(':')!= -1">
        <a href='<s:property/>'><small>Click Here </small></a>
    </s:if>                     
</s:if>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM