struts标签bean:cookie,bean:write,logic:page,logic:present,logic:iterate使用实例
2008-05-12 16:37
489 查看
jsp页面index.jsp:
<%@page contentType="text/html;charset=gb2312" language="java"%>
<%@taglib uri="/WEB-INF/struts-html.tld" prefix="html"%>
<%@taglib uri="/WEB-INF/struts-bean.tld" prefix="bean"%>
<%@taglib uri="/WEB-INF/struts-logic.tld" prefix="logic"%>
<html>
<head><title>struts test</title></head>
<body> <bean:cookie id="jSession" name="userInfo" value="11111"/>
<!-- 其它标签通过绑定到page作用域中的属性使用该值 -->
这个cookie的名称是<bean:write name="jSession" property="name"/>,值为<bean:write name="jSession" property="value"/>。<br/>
<!-- JSP脚本通过scripting变量使用该值 -->
<%
String name = jSession.getName();
String value = jSession.getValue();
out.println("这个cookie的名称是"+name+",值为"+value+"。<br/>");
%>
<html:form action="login" method="post">
<html:text property="user" value="hello" /><html:errors property="user"/>
<html:text property="pwd" /><html:errors property="pwd" />
<br>
<html:errors />
<html:checkbox property="cb" value="1">fe</html:checkbox><html:errors property="cb" />
<html:submit value="提交" />
</html:form><bean:page id="te" property="request" />
<%=te.getContentType()%><br>string attribute:
<logic:present name="tdstr">
<bean:write name="tdstr" /><br />
</logic:present>other object attribute:
<logic:present name="tdobj">
<bean:write name="tdobj" property="user"/><br />
</logic:present>iterate other Array object attribute:<br />
<logic:present name="sarr">
<logic:iterate id="sobj" name="sarr">
<bean:write name="sobj" /><br />
</logic:iterate>
</logic:present>iterate other Hashtable object attribute:<br />
<logic:present name="htobj">
<logic:iterate id="hto" name="htobj">
<bean:write name="hto" property="key" />:<bean:write name="hto" property="value" /><br />
</logic:iterate>
</logic:present></body>
</html>-
<%@page contentType="text/html;charset=gb2312" language="java"%>
<%@taglib uri="/WEB-INF/struts-html.tld" prefix="html"%>
<%@taglib uri="/WEB-INF/struts-bean.tld" prefix="bean"%>
<%@taglib uri="/WEB-INF/struts-logic.tld" prefix="logic"%>
<html>
<head><title>struts test</title></head>
<body> <bean:cookie id="jSession" name="userInfo" value="11111"/>
<!-- 其它标签通过绑定到page作用域中的属性使用该值 -->
这个cookie的名称是<bean:write name="jSession" property="name"/>,值为<bean:write name="jSession" property="value"/>。<br/>
<!-- JSP脚本通过scripting变量使用该值 -->
<%
String name = jSession.getName();
String value = jSession.getValue();
out.println("这个cookie的名称是"+name+",值为"+value+"。<br/>");
%>
<html:form action="login" method="post">
<html:text property="user" value="hello" /><html:errors property="user"/>
<html:text property="pwd" /><html:errors property="pwd" />
<br>
<html:errors />
<html:checkbox property="cb" value="1">fe</html:checkbox><html:errors property="cb" />
<html:submit value="提交" />
</html:form><bean:page id="te" property="request" />
<%=te.getContentType()%><br>string attribute:
<logic:present name="tdstr">
<bean:write name="tdstr" /><br />
</logic:present>other object attribute:
<logic:present name="tdobj">
<bean:write name="tdobj" property="user"/><br />
</logic:present>iterate other Array object attribute:<br />
<logic:present name="sarr">
<logic:iterate id="sobj" name="sarr">
<bean:write name="sobj" /><br />
</logic:iterate>
</logic:present>iterate other Hashtable object attribute:<br />
<logic:present name="htobj">
<logic:iterate id="hto" name="htobj">
<bean:write name="hto" property="key" />:<bean:write name="hto" property="value" /><br />
</logic:iterate>
</logic:present></body>
</html>-
相关文章推荐
- struts标签bean:cookie,bean:write,logic:page,logic:present,logic:iterate使用实例
- struts标签bean:cookie,bean:write,logic:page,logic:present,logic:iterate使用实例
- struts1 logic:iterate bean:write标签使用
- Struts标签<bean:write><logic:iterate></logic:equal>的组合使用小例
- Struts标签---logic:Iterate使用方法
- struts之<bean:write>及<logic:iterate>
- 使用struts的logic:iterate标签遍历列表时得到显示序号
- 使用struts bean:write标签时不能显示Integer,Date等类型的属性问题的解决
- 使用struts中bean:write标签格式化输出
- 4-Struts标签的使用--logic(empty, notEmpty, present, notPresent)
- Struts标签---logic:Iterate使用方法
- 【struts】——bean_write标签使用
- 使用Struts中logic:iterate标签的问题
- 使用struts bean:write标签时不能显示Integer,BigDecimal等类型的属性问题的解决
- struts标签 logic:iterate(转)非常详细的使用
- 使用struts1.x标签<logic:iterate>来输出map,list
- struts中logic:iterate标签的使用
- Struts标签 bean:write用法
- 标签<logic:present>的使用
- struts标签库:logic:empty logic:notPresent struts-config.xml