struts学习笔记6
2012-03-02 16:53
183 查看
struts提供了三大常用标签库:html,bean,logic
html标签:用来代替普通标签,支持自动回填功能(出错时可以回填,修改时设置默认值也可以回填)
bean标签:显示数据到页面上,支持设置属性功能,支持国际化
login标签:循环判断功能
1.logic标签
判断标签一共6组,12个:
logic:present,logic:notPresent:判断某个属性是否存在
logic:equal,logic:notEqual:判断属性是否等于或不等于某个值
logic:greaterThan,logic:lessThan:判断属性大于或小于某个值
logic:empty,logic:notEmpty:判断某个属性值是否为空
logic:match,logic:notMatch:判断属性是否匹配某一个字符串
logic:iterate:循环迭代某个集合属性
2.bean标签
可以通过bean:define,bean:include,bean:size等向属性范围中临时设置属性。(一般不用)
需要记住的标签:
bean:write:功能与EL类似,用来将属性显示到页面上。可以过滤非法字符。
<bean:write name="news" property="content"/>
而且支持日期和金额的格式化显示。
<bean:write name="news" property="postDate" format="yyyy-MM-dd"/>
<bean:write name="money" format="¥,##0.00"/>
bean:message标签可以取得属性文件中的内容,并显示到页面上。主要用来完成国际化功能。
3.html标签
html标签:用来代替普通标签,支持自动回填功能(出错时可以回填,修改时设置默认值也可以回填)
bean标签:显示数据到页面上,支持设置属性功能,支持国际化
login标签:循环判断功能
1.logic标签
判断标签一共6组,12个:
logic:present,logic:notPresent:判断某个属性是否存在
logic:equal,logic:notEqual:判断属性是否等于或不等于某个值
logic:greaterThan,logic:lessThan:判断属性大于或小于某个值
logic:empty,logic:notEmpty:判断某个属性值是否为空
logic:match,logic:notMatch:判断属性是否匹配某一个字符串
logic:iterate:循环迭代某个集合属性
2.bean标签
可以通过bean:define,bean:include,bean:size等向属性范围中临时设置属性。(一般不用)
需要记住的标签:
bean:write:功能与EL类似,用来将属性显示到页面上。可以过滤非法字符。
<bean:write name="news" property="content"/>
而且支持日期和金额的格式化显示。
<bean:write name="news" property="postDate" format="yyyy-MM-dd"/>
<bean:write name="money" format="¥,##0.00"/>
bean:message标签可以取得属性文件中的内容,并显示到页面上。主要用来完成国际化功能。
3.html标签
Html标签 | 普通表单 | |
表单 | Html:form 只能提交.do路径(只能进入Action) 默认提交方式是post 自动验证提交路径是否存在 | <form> 可以提交任意路径。 默认提交方式为get 无论路径是否存在,表单都可以显示。 |
功能相同的标签 | <html:button> <html:submit> <html:reset> <html:image> 两者使用上没有区别,<html:>标签必须在<html:form>中使用 | <input type=”button”> <input type=”submit”> <input type=”reset”> <intpu type=”image”> 可以在任意表单中使用 |
输入类标签 | <html :text> <html :password> <html :textarea> <html:hidden> 参数名使用property=””来定义 使用styleId 使用styleClass 支持回填 | <input type=”text”> <input type=”password> <textarea></textarea> <input type=”hidden”> 参数名使用 name=””定义 使用id 使用class 不支持回填” |
单选按钮 | <html:radio> 通过回填功能设置默认选中 | <input type=”radio”> 使用checked属性设置默认选中 |
下拉列表 | <html:select> <html:option> 默认选中通过回填 支持直接将List集合转化机为下拉列表的功能。 <html:options>或<html:optionCollection>都可以实现。 | <select> <option> 默认选中使用selected |
多选框 | <html:checkbox> 不支持默认选中 <html:multibox> 支持默认选中(通过回填) | <inputtype=“checkbox”> 默认选中使用checked |
相关文章推荐
- [struts1]学习笔记1 简单搭建基础
- Struts学习笔记1
- [原创]java WEB学习笔记66:Struts2 学习之路--Struts的CRUD操作( 查看 / 删除/ 添加) 使用 paramsPrepareParamsStack 重构代码 ,PrepareInterceptor拦截器,paramsPrepareParamsStack 拦截器栈
- 巴巴运动网学习笔记四之在Web层集成Struts2.3与Spring3.1
- [原创]java WEB学习笔记56:Struts2学习之路---Struts 版本的 登录 demo
- 黑马程序员-struts1学习笔记1
- Struts学习笔记
- Struts1.x 学习笔记
- Struts学习笔记一
- 【SSH学习笔记】—从配置Struts1环境到简单实例
- Struts学习笔记
- Struts 1 Validator 学习笔记
- JasperReport学习笔记8-JasperReport和Hibernate,Struts的整合
- struts 学习笔记(二)类型转化
- Struts 学习笔记1 -Struts Framework 概览
- Struts2.1 OGNL 表达式 学习笔记
- struts2.0 学习笔记
- J2EE学习笔记(8) 真是知易行难 初试Struts
- [struts2学习笔记] 第二节 使用Maven搞定管理和构造Struts 2 Web应用程序的七个步骤
- struts学习笔记之Struts标签的配置使用