struts 2 if tag用于比较字符类型 [英] struts 2 if tag for comparing character type

查看:109
本文介绍了struts 2 if tag用于比较字符类型的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我无法使用以下代码比较字符类型

I am not able to compare character type by using the below code

<s:if test='aCharType == "Y"'>
  This is not working
</s:if>

这里的aCharType是长度为1的字符类型。

Here is aCharType is of character type of length 1 .

我用google搜索我知道struts 2的问题,如果标签适用于
字符串类型。

I googled the problem by which i came know that struts 2 if tags works with String type.

请告诉我解决方案如果你拥有它。

plz let me know solution if you have it.

推荐答案

您正在将 aCharType 与String进行比较Y,将其与char 'Y'进行比较

You are comparing your aCharType with a String "Y", compare it with char 'Y'

<s:if test="aCharType == 'Y'">
  This is working
</s:if>

这篇关于struts 2 if tag用于比较字符类型的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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