JSTL if标记相等的字符串 [英] JSTL if tag for equal strings

查看:119
本文介绍了JSTL if标记相等的字符串的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的JSP页面上的对象有一个变量:

I've got a variable from an object on my JSP page:

<%= ansokanInfo.getPSystem()%>

变量的值是NAT,这是正确的,我想为这个值应用某些页面元素。如何使用标签来了解案例?我试过类似

The value of the variable is NAT which is correct and I want to apply certain page elements for this value. How do I use a tag to know the case? I tried something like

<c:if test = "${ansokanInfo.getPSystem() == 'NAT'}">      
   process  
</c:if> 

但上面没有显示任何内容。我该怎么办?或者我也可以使用scriptlet,即

But the above doesn't display anything. How should I do it? Or can I just as well use scriptlets i.e.

<% if (ansokanInfo.getPSystem().equals("NAT"){ %>
process
<% } %>

谢谢任何答案或评论。

推荐答案

尝试:

<c:if test = "${ansokanInfo.PSystem == 'NAT'}">

JSP / Servet 2.4(我认为是版本号)不支持EL中的方法调用,只支持属性。最新的servlet容器支持方法调用(即Tomcat 7)。

JSP/Servet 2.4 (I think that's the version number) doesn't support method calls in EL and only support properties. The latest servlet containers do support method calls (ie Tomcat 7).

这篇关于JSTL if标记相等的字符串的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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