如何在Struts2中检查s:if中的字符串不等式 [英] How to check string inequality in s:if in Struts2

查看:76
本文介绍了如何在Struts2中检查s:if中的字符串不等式的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在jsp-s之一中使用Struts2的<s:if>标记.是这样的:

I am using <s:if> tag of Struts2 in one of the jsp-s. It is something like this:

<s:if test="%{#request.STATUS.equals('SINGLE')}">
    ...
    ...
</s:if>

工作正常.现在,在此代码下面,我想编写一个仅在状态不为单个时才起作用的代码.所以我用

It works fine. Now below this code, I want to write a code which will work only when status is not single. So I used

<s:if test="!(%{#request.STATUS.equals('SINGLE')})">
    ...
    ...
</s:if>

但这不起作用.我也尝试过,

But this does not work. I also tried,

<s:if test="!%{#request.STATUS.equals('SINGLE')}">
    ...
    ...
</s:if>

这是一个小问题,但是不知道为什么它不起作用.我想知道如何在s:if标记中完成字符串不等式.

This is a small issue, but don't know why it is not working. I want to know how string inequality can be done in s:if tag.

推荐答案

您可以比较以下字符串:

You can Compare a String Like:

<c:if test="%{#request.STATUS!='SINGLE'}">
......</br>
......<br />
</c:if>

这篇关于如何在Struts2中检查s:if中的字符串不等式的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆