下面总结一下struts2 中if标签的使用
(1)判断字符串是否为空
<s:if test="user.username==null or user.username==''"> |
<s:if test='ab123==null'> ab123 is null </s:if> <s:else> ab123 not null </s:else> |
(2) 判断字符串是否为指定值
<s:if test="user.username eq \"a\""> is a </s:if> <s:else> not a </s:else> |
或者:
<s:if test="user.username==\"a\""> |
或者:
<s:if test='user.username eq "a"'> |
使用单引号把双引号括起来
下面的是错误的:
<s:if test="user.username=='a'"> |
<s:if test="user.username eq 'a'"> |
(3) 判断list是否有值
<s:if test="null==list2 or 0==list2.size">为空</s:if> <s:else>有值</s:else> |
(4) 判断数字是否为负数
<s:if test="user.age lt 0">小于0</s:if> <s:else>大于零</s:else> |
(5) 判断list的长度是否为指定值
<s:if test="2==list2.size">为2</s:if> <s:else>不为2</s:else> |
相关推荐
struts2配置文件以及代码示例struts2配置文件以及代码示例struts2配置文件以及代码示例struts2配置文件以及代码示例struts2配置文件以及代码示例struts2配置文件以及代码示例struts2配置文件以及代码示例struts2配置...
struts2 入门示例程序struts2 入门示例程序struts2 入门示例程序struts2 入门示例程序struts2 入门示例程序struts2 入门示例程序struts2 入门示例程序struts2 入门示例程序
struts2 <s:if>标签使用struts2 <s:if>标签使用struts2 <s:if>标签使用struts2 <s:if>标签使用struts2 <s:if>标签使用struts2 <s:if>标签使用
struts2的验证框架的示例代码,快速学习和使用struts2验证框架
Struts2框架程序示例
最近在做struts2的学习研究,这里共享一份完整能运行的示例
主要介绍Strus2中的通用标签,主要有, , , <s:if>, <s:elseif>, , , , , 等几个标签的具体用法,希望能对大家有帮助。
个人开发时遇到的struts标签的if标签是,将其功能遗忘,可以用来巩固记忆
Struts2示例
struts2+hibernate示例,描述了框架的搭建方式,还有基础jar包的添加。连接数据库为Mysql,另外添加了jdbc的示例。
Struts示例demo
jsp中struts2.0标签应用示例,介绍了部分标签的使用,里面有详细的文档说明。
struts2示例(包括tomcat连接池)struts2示例(包括tomcat连接池)struts2示例(包括tomcat连接池)
<%@ taglib uri="/struts-tags" prefix="s" %> 结合例子,重点掌握以下标签的用法 (1) (2) (3) <s:if> 、<s:elseif>、 (4) (5) (6) 、 (7) 、、、 (8) 、、<s:checkboxlist>
Struts2框架示例.docStruts2框架示例.docStruts2框架示例.docStruts2框架示例.docStruts2框架示例.docStruts2框架示例.docStruts2框架示例.docStruts2框架示例.docStruts2框架示例.docStruts2框架示例.docStruts2...
这是使用Eclipse 3.3, JDK 6.0,以及Tomcat 6.0翻写的Struts2的演示程序。它是了解和学习Struts2的好例子。
struts1和struts2的区别struts1和struts2的区别struts1和struts2的区别struts1和struts2的区别struts1和struts2的区别struts1和struts2的区别struts1和struts2的区别struts1和struts2的区别struts1和struts2的区别...
struts taglib使用示例 struts taglib使用示例 struts taglib使用示例struts taglib使用示例 struts taglib使用示例
struts 2.3.7简单示例。...示例实现用户登录功能,由于该示例是ssh整合的第一步,所以并未包含Spring、Hibernate框架,仅是Struts2的示例。 如果需要其他整合,请看:http://blog.csdn.net/xz2001/
Struts2 UI标签示例(包含tabbedPanel标签,autocompleter标签,tree和treenode,optiontransferselect标签等)