struts1.x的标签使用

struts1.x的标签使用:

1.我们可以通过strut框架提供的<html:...格式的标签来绑定数据
*. <html:form action="/login" method="post" οnsubmit="return check(this)">
其中 action的值要和struts主配置文件中 处理该请求的path属性值一致,
同时表单同样可以进行Javascript验证
function check(obj)
{
var uname=obj.elements['user.uname'].value;
........
}
2.通过<bean:message key="zf.login.button"/>来输出资源文件中的信息
3.通过<html:errors property="pass_error"/>输出错误提示信息
4.通过<html:errors/>输出错误容器中的所有错误信息
5.<html:hidden property="operate" value="toList"/>相当于<input type="hidden" name="operate" value="toList"/>
6.<html:submit value="查询" styleClass="mouseoverstyle"......、>通过styleClass属性来调用类级别样式
7.<%-- 定义页面变量fwList
<bean:define id="fwList" type="java.util.List" name="fwxxList" scope="requst"/>
id属性: 相当于声明一个名叫fwList的变量
type属性:表示该变量的类型
name属性:表示域中的对象名
scope属性:表示将变量保存的域范围
共找到<%=fwList.size() %>
--%>
8.通过<bean:size id="count" name="fwxxList"/>获取域中名为fwxxList集合的大小,并赋给count变量
共找到${ count}
9.<logic:notEmpty name="currentUser" scope="session">
*.表示在session范围内,查找名字为user的属性,如果找到了,而且值不为null,则执行logic:notEmpty标签内的内容
10.<logic:equal name="fwxx" property="uid" value="${sessionScope.currentUser.uid}" >.....</logic:equal>
*.表示域中fwxx代表的对象的uid属性是否与value值相等,如果相等则执行logic:equal标签中的内容
11.<bean:write name="fwxx" property="zj" format="#,###.##"/>格式化输出
12. <logic:iterate id="fwxx" name="fwxxList">....</logic:iterate>
*.表示通过id属性指定的变量循环遍历name属性所指定的集合
13.<html:select property="condition.qxid">
<html:optionsCollection value="qxid" label="qx" name="qxList"/>
</html:select>
*.property="condition.qxid"表示将下列框选中值赋给formBean中condition实体对象的qxid
*.<html:optionsCollection value="qxid" label="qx" name="qxList"/>
*.其中html:optionsCollection用来绑定集合
*.label="qx"表示将qxList集合中实体对象的qx属性作为呈现文本
*.label="qxid"表示将实体对象的qxid属性作为呈现文本
*.value="qxid"表示将实体对象的qxid属性作为下拉框选项的值
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值