struts tags bean

struts tags bean
1.将以下三个常用struts tags 放到一个jsp页面下:
    tags.jsp
    <%@ taglib uri="http://struts.apache.org/tags-bean" prefix="bean"%> 
    <%@ taglib uri="http://struts.apache.org/tags-html" prefix="html"%>
    <%@ taglib uri="http://struts.apache.org/tags-logic" prefix="logic"%>

  2.bean标签
 <bean:cookie id="sess" name="JSESSIONID" value="JSESSIONID-IS-UNDEFINED"/>
将JSESSIONID的cookie定义为id为sess的bean
显示sess的comment属性:<bean:write name="sess" property="comment"/>
显示sess的maxAge属性:<bean:write name="sess" property="maxAge"/>
显示sess的path属性:<bean:write name="sess" property="path"/>
显示sess的secure属性:<bean:write name="sess" property="secure"/>
显示sess的value属性:<bean:write name="sess" property="value"/>
显示sess的version属性:<bean:write name="sess" property="version"/> 

<bean:define/>:
<bean:define id="bianliang name" value="bianliang value"/>  int i=0;
<bean:define id="variable1" name="variable2"/> //将variable2赋给variable1,同时定义了variable1
<bean:define id="variableName" name="beanName" property="beanProperty"/>将bean的property赋给variableName
<bean:define id="bean1" name="bean2" scope="scope1" toScope="scope2"/> 将scope1范围中的bean1转换到scope2范围中的bean2

<bean:header/>:
<bean:header id="variableName" name="headerName"/> 将headerName的请求头定义成variableName变量

<bean:parameter/>:
<bean:parameter id="variableName" name="parameter"/>将请求parameter的请求参数的值赋给variableName
url?b=xxx
<bean:parameter id="a" name="b"/>

<bean:include/>:
<bean:include id="beanName" path="uri"/>将uri对应的jsp资源赋给bean

你可能感兴趣的:(struts tags bean)