开发者

Are compound if statements possible with Struts2 <s:if> tag?

I have a 开发者_如何学运维page that will display one of two options for a Struts2 JSP.

The problem I am running in to is that I have have to continually nest my statements because I cannot figure out how create compound if statements with this tag. Currently my code looks like this:

<s:if test="%{caseDto.siteId!=null}">
    <s:if test="%{caseDto.siteId!=0}">
        <span id="validAcctSpan" class="goodMessage">
            <s:textfield name="caseDto.siteId" label="Account Number"

...

I would like to know if Struts supports a syntax of something along the lines of:

<s:if test="%{caseDto.siteId!=null && caseDto.siteId!=0}">
    <span id="validAcctSpan" class="goodMessage">
        <s:textfield name="caseDto.siteId" label="Account Number"

...

Is this possible? I'm open to other/better ways of performing the same action. I am still new to Struts2, so I'm sure there is a better way.


You can use compound if statements with Struts2. Using && operator is OK for it.

For OGNL, check this document: https://commons.apache.org/proper/commons-ognl/language-guide.html

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜