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
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章