STRUTS标

来源:互联网 发布:怎么扩大生活圈子 知乎 编辑:程序博客网 时间:2024/06/09 18:09
1
struts标签html标签bean标签logic标签html标签是普通的html标签,struts设计者主要为html标签做了封装说明:.tld是标签描述文件<%@ taglib uri="http://struts.apache.org/tags-html" prefix="html" %><html:button property="mybtn1" value="提交"></html:button>struts的html涉及输入,要求和一个表单类对应,而且应当放到一个<html:form>中bean标签库 该标签可以创建bean,访问bean<%@ taglib uri="http://struts.apache.org/tags-bean" prefix="html" %>//用于输出<%request.setAttribute("abc","hello");%><bean:write name="abc" />//输出对象属性值<bean:write name="cat1" property="name" /> cat1为域对象,name为属性<bean:message>标签资源文件ApplicationResources.properties内容key1 =welcome{0} //0是外部传过来的值<bean:message key="key1" arg0="john"> 也可以定义错误号err1=your err is{0}<bean:message key="err1" arg0="密码为空">logic标签主要用于管理循环和条件的输出<%@ taglib uri="http://struts.apache.org/tags-logic" prefix="html" %><logic:iterate id="mycat" name="cats">${mycat.name}//EL表达式</logic:iterate><logic:empty name="cats">cats不存在</logic:empty><logic:noEmpty name="cats"></logic:noEmpty>

0 0
原创粉丝点击