博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
struts标签bean:cookie,bean:write,logic:page,logic:present,logic:iterate使用实例
阅读量:4220 次
发布时间:2019-05-26

本文共 1687 字,大约阅读时间需要 5 分钟。

jsp页面index.jsp:
< contentType="text/html;charset=gb2312" language="java"%>
< uri="/WEB-INF/struts-html.tld" prefix="html"%>
< uri="/WEB-INF/struts-bean.tld" prefix="bean"%>
< 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>

转载地址:http://xclmi.baihongyu.com/

你可能感兴趣的文章
osg中使用MatrixTransform来实现模型的平移/旋转/缩放
查看>>
(一) Qt Model/View 的简单说明
查看>>
(二)使用预定义模型 QStringListModel例子
查看>>
UVM:7.4.5 加入存储器
查看>>
UVM:7.5.1 期望值与镜像值
查看>>
UVM:7.5.2 常用操作及其对期望值和镜像值的影响
查看>>
UVM:7.6.1 检查后门访问中hdl 路径的sequence
查看>>
UVM:7.6.2 检查默认值的sequence
查看>>
UVM:7.7.1 使用reg_predictor
查看>>
UVM:7.7.2 使用UVM_PREDICT_DIRECT功能与mirror 操作
查看>>
UVM:7.7.3 寄存器模型的随机化与update
查看>>
UVM:7.7.4 扩展位宽
查看>>
UVM:7.8.1 get_root_blocks
查看>>
UVM:7.8.2 get_reg_by_offset 函数
查看>>
UVM:8.1.1 任务与函数的重载
查看>>
UVM:8.1.2 约束的重载
查看>>
UVM:8.2.2 重载的方式及种类
查看>>
UVM:8.2.3 复杂的重载
查看>>
UVM:8.2.4 factory 机制的调试
查看>>
UVM:8.3.1 重载transaction
查看>>