Struts中logic部分标签实例
来源:互联网 发布:淘宝网店开 编辑:程序博客网 时间:2024/06/03 14:28
本文主要内容是参考:http://x.discuz.net/131976/viewspace-90916.html
<%@ page language="java" pageEncoding="utf-8"%>
<%@ taglib uri="http://jakarta.apache.org/struts/tags-bean"
prefix="bean"%>
<%@ taglib uri="http://jakarta.apache.org/struts/tags-html"
prefix="html"%>
<%@ taglib uri="http://jakarta.apache.org/struts/tags-logic"
prefix="logic"%>
<%@ taglib uri="http://jakarta.apache.org/struts/tags-tiles"
prefix="tiles"%>
<%@ taglib uri="http://jakarta.apache.org/struts/tags-template"
prefix="template"%>
<%@ taglib uri="http://jakarta.apache.org/struts/tags-nested"
prefix="nested"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html:html locale="true">
<head>
<html:base />
<title>a.jsp</title>
<!-- -->
</head>
<body>
This a struts page.
<br>
<%
String[] testArray = { "str0", "str1", "str2", "str3", "str4",
"str5" };
pageContext.setAttribute("test", testArray);
%>
<logic:iterate id="array" name="test">
<bean:write name="array" />
</logic:iterate>
<!--logic:iterate中的id="suibiana"与bean:write中的name="suibiana"对应,名字随便起。
logic:iterate中的name="test"与pageContext.setAttribute("test",testArray)中
的"test"对应。
logic:iterate中:
length="1"表示输出几个数据;
offset="0"表示从第几个开始输出。
-->
<h1>
更高级的
</h1>
<logic:iterate id="suibiana" name="test" length="1" offset="0">
<bean:write name="suibiana" />
<br>
</logic:iterate>
<br>
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
<br>
<h1>
logic:equal
</h1>
<%
pageContext.setAttribute("equal", new Integer(1000));
%>
<!-- logic:equal中的name="equal"与pageContext.setAttribute("equal",new Integer(1000))中
的"equal"对应。
logic:equal中的value="1000"与pageContext.setAttribute("equal",new Integer(1000))中
的Integer(1000)做比较。
如果两个值相等则执行
<logic:equal value="1000" name="equal">
test=1001
</logic:equal>
logic标签中间的程序,此程序为在页面显示test=1001。否则不执行这之间的程序。
-->
<logic:equal value="1000" name="equal">
test=1001
</logic:equal>
<h1>
logic:greaterThan
</h1>
<!-- 比较两个值不等;但此方法不稳定value="10101"时也无输出,value="10"时有输出。
Warning:测试后结果极难理解,尽量避免此方法的应用!
-->
<logic:greaterThan value="10" name="equal">
true
</logic:greaterThan>
<br>
<h1>
logic:match
</h1>
<%
pageContext.setAttribute("match","helloWord");
%>
<!-- 如果logic:match中的value="hello"的值能在pageContext.setAttribute("match","helloWord")中
的"helloWord"里找到,则执行logic:match标签之间的
<logic:match value="hello" name="match">
hello 在helloWord中
</logic:match>
中的内容,本程序在页面输出“hello 在helloWord中”。
如果找不到,则不执行以上程序。
-->
<logic:match value="hello" name="match">
hello 在helloWord中
</logic:match>
<br>
<h1>match:match location="start"</h1>
<!--location="start"比较是否以特定字段开始 -->
<logic:match value="hello" name="match" location="start">
helloWord以 hello开头
</logic:match>
<br>
<h1>logic:match location="end"</h1>
<!--location="end"比较是否以特定字段结尾 -->
<logic:match value="d" name="match" location="end">
helloWord以 d结尾
</logic:match>
</body>
</html:html>
- Struts中logic部分标签实例
- struts中logic标签说明
- struts标签:logic标签
- Struts标签--logic标签
- struts中logic:iterator标签的使用
- struts中logic:iterate标签的使用
- struts标签bean:cookie,bean:write,logic:page,logic:present,logic:iterate使用实例
- struts标签bean:cookie,bean:write,logic:page,logic:present,logic:iterate使用实例
- struts标签bean:cookie,bean:write,logic:page,logic:present,logic:iterate使用实例
- Struts的logic标签
- Struts标签-Logic介绍
- Struts的logic标签
- Struts标签-Logic
- Struts-Logic 标签库
- struts标签-------logic
- [Struts]Logic 标签库
- Struts-Logic 标签库
- struts中的logic标签
- C#制作屏幕捕捉程序
- 转一篇好文章:数据库开发者常犯的十大错误
- ISP简介(ISP--Interface Segregation Principle)
- 在项目开发总的一些感受,希望大家共同来探讨项目管理中的一些看法
- C# 事件的继承
- Struts中logic部分标签实例
- 数据结构与算法(C#实现)系列---二叉树
- uname gethostbyname 结合获取本机地址
- GNU通用公共许可证(中--英对照)
- smartUpload文件上传组件
- 关于CSDN的网摘
- “Hello World!”的N种写法
- 一年过去了,本周日将去实习了
- SimpleServlet.java