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
posted on 2008-05-15 23:00
長春語林科技 閱讀(753)
評論(0) 編輯 收藏 所屬分類:
struts