struts中常用的标签
2009-10-05 11:16
204 查看
<%@ taglib uri="http://struts.apache.org/tags-bean" prefix="bean" %>
<%@ taglib uri="http://struts.apache.org/tags-html" prefix="html" %>
<%@ taglib uri="http://struts.apache.org/tags-logic" prefix="logic" %>
<%@ taglib uri="http://struts.apache.org/tags-tiles" prefix="tiles" %>
==============================================================
<html:errors/>显示错误信息
==============================================================
<p2><a href="#" onclick="history.back()">返回上一页</a></p2>
======================================================
<logic:present name="all" scope="request">
<logic:iterate id="item" name ="all" scope="request">
${item.itemname}<br>
<logic:iterate id="subitem" name="item" property="subitems">
|-${subitem.subname}<br>
</logic:iterate>
</logic:iterate>
</logic:present >
=============================================================
使用bean:size 得到集合数据记录数
<bean:size id = "count" name ="list" />
共找到${count}条记录
=============================================================
bean:define标签的使用
<bean:define id = "dataList" type="java.util.List" name="list" scope="request" />
共找到<%=dataList.size()%>条记录
=============================================================
使用bean:write格式化输出 代替DecimalFormat和DataFormat
<logic : iterate id="fwxx" name="list">
<bean:write name="fwxx" property="#,###"/>元
<bean:write name="fwxx" property="yyyy"年MM月dd日/>
</logic>
====================================================
记住下面这种连接的写法技巧,说不准以后能用的到:
<logic : iterate id ="fwxx" name="list">
<a href='detail.do?fwid=${fwxx.fwid}'>${fwxx.title}</a>
</logic:iterate>
=========================================================
<logic:notEmpty name="user" scope="session">
.......
</logic:notEmpty>
======================
<html:select property="condition.qxid" style="width:80px">
<html:optionsCollection name="qxList" label="px" value="qxid"/>
</html:select>
上述代码中集合的每个元素都是QX实体对象,qx和qid都是QX实体对象的属性名,如果有{1,海淀区}的对象,将输出到客户端得html代码为
“<option value="1">海淀区</option>”;
<%@ taglib uri="http://struts.apache.org/tags-html" prefix="html" %>
<%@ taglib uri="http://struts.apache.org/tags-logic" prefix="logic" %>
<%@ taglib uri="http://struts.apache.org/tags-tiles" prefix="tiles" %>
==============================================================
<html:errors/>显示错误信息
==============================================================
<p2><a href="#" onclick="history.back()">返回上一页</a></p2>
======================================================
<logic:present name="all" scope="request">
<logic:iterate id="item" name ="all" scope="request">
${item.itemname}<br>
<logic:iterate id="subitem" name="item" property="subitems">
|-${subitem.subname}<br>
</logic:iterate>
</logic:iterate>
</logic:present >
=============================================================
使用bean:size 得到集合数据记录数
<bean:size id = "count" name ="list" />
共找到${count}条记录
=============================================================
bean:define标签的使用
<bean:define id = "dataList" type="java.util.List" name="list" scope="request" />
共找到<%=dataList.size()%>条记录
=============================================================
使用bean:write格式化输出 代替DecimalFormat和DataFormat
<logic : iterate id="fwxx" name="list">
<bean:write name="fwxx" property="#,###"/>元
<bean:write name="fwxx" property="yyyy"年MM月dd日/>
</logic>
====================================================
记住下面这种连接的写法技巧,说不准以后能用的到:
<logic : iterate id ="fwxx" name="list">
<a href='detail.do?fwid=${fwxx.fwid}'>${fwxx.title}</a>
</logic:iterate>
=========================================================
<logic:notEmpty name="user" scope="session">
.......
</logic:notEmpty>
======================
<html:select property="condition.qxid" style="width:80px">
<html:optionsCollection name="qxList" label="px" value="qxid"/>
</html:select>
上述代码中集合的每个元素都是QX实体对象,qx和qid都是QX实体对象的属性名,如果有{1,海淀区}的对象,将输出到客户端得html代码为
“<option value="1">海淀区</option>”;
相关文章推荐
- 常用struts标签使用举例--bean篇(转载)
- struts常用标签总结
- Struts 有哪些常用标签库
- struts常用标签举例
- Struts 2 常用标签(Tag)详解
- struts.xml中常用到的标签
- 常用struts标签使用举例--logic篇 (转载)
- validation.xml验证文件的配置 常用struts标签使用举例--bean篇
- struts中的标签三个最常用的属性
- STRUTS2 常用标签的使用
- 常用struts标签使用举例--bean篇(转载)
- 常用struts标签使用举例--logic篇 (转载)
- SSH(struts+spring+hibernate)迅速开发--附录2 Struts 常用标签&amp;国际化(1)
- Struts 有哪些常用标签库
- 传智播客 struts1.x 常用标签的使用
- JAVAWEB开发之Struts2详解(四)——ognl与valueStack(重点)、Struts常用标签、防止表单重复提交、Struts2中内置json插件
- struts常用标签总结
- Struts2笔记——struts常用标签
- STRUTS2.0 常用标签 struts2标签 s
- SSH(struts+spring+hibernate)迅速开发--附录2 Struts 常用标签&国际化(2)