A:
<s:a href=""></s:a>-----超鏈接,類似于html里的<a></a>
<s:action name=""></s:action>-----執(zhí)行一個(gè)view里面的一個(gè)action
<s:actionerror/>-----如果action的errors有值那么顯示出來
<s:actionmessage/>-----如果action的message有值那么顯示出來
<s:append var="newMerList">-----添加一個(gè)值到list,類似于list.add();
<s:param value="merList1"></s:param>
<s:param value="merList2"></s:param>
</s:append>
<s:autocompleter></s:autocompleter>-----自動(dòng)完成<s:combobox>標(biāo)簽的內(nèi)容,這個(gè)是ajax
B:
<s:bean name=""></s:bean>-----類似于struts1.x中的,JavaBean的值
C:
<s:checkbox></s:checkbox>-----復(fù)選框
<s:checkboxlist list=""></s:checkboxlist>-----多選框
<s:combobox list=""></s:combobox>-----下拉框
<s:component></s:component>-----圖像符號(hào)
D:
<s:date name="time" format="yyyy/MM/dd"/>-----獲取日期格式
<s:datetimepicker></s:datetimepicker>-----日期輸入框
<s:debug></s:debug>-----顯示錯(cuò)誤信息
<s:div></s:div>-----表示一個(gè)塊,類似于html的<div></div>
<s:doubleselect list="#appVar3" listKey="id" listValue="name" name="" doubleName="chinagra.chinagraCategory.id" -----雙下拉框
doubleId="mid" doubleList="#appVar4.get(top.id)" doubleListKey="id" doubleListValue="title" theme="simple"/>
List<Category> categories = chinagraService.searchProblemCategories();;
Map<Long, List<ChinagraCategory>> chinagraCategories = new HashMap<Long, List<ChinagraCategory>>();
for(Category category : categories) {
chinagraCategories.put(category.getId(), chinagraCategoryService.queryByType(category.getId().toString()));
}
E:
<s:if test=""></s:if>
<s:elseif test=""></s:elseif>
<s:else></s:else>-----這3個(gè)標(biāo)簽一起使用,表示條件判斷
F:
<s:fielderror></s:fielderror>-----顯示文件錯(cuò)誤信息
<s:file></s:file>-----文件上傳
<s:form action=""></s:form>-----獲取相應(yīng)form的值
G:
<s:generator separator="'aaa,bbb,ccc,ddd'" val=",">
<s:iterator>
<s:property/>
</s:iterator>
</s:generator>----和<s:iterator>標(biāo)簽一起使用
H:
<s:head/>-----在<head></head>里使用,表示頭文件結(jié)束
<s:hidden name="user.name" value="junly"/></s:hidden>-----隱藏值
I:
<s:i18n name=""></s:i18n>-----加載資源包到值堆棧
<s:include value=""></s:include>-----包含一個(gè)輸出,servlet或jsp頁(yè)面
<s:inputtransferselect list=""></s:inputtransferselect>-----獲取form的一個(gè)輸入
<s:iterator value="userlist" var="user" status="s">
<s:if test="#s.index == 0">
<s:property value="name"/>
</s:if>
<s:property value="#s.even"/>
<s:property value="#s.odd"/>
<s:property value="#s.first"/>
<s:property value="#s.last"/>
<s:property value="#s.count"/>
</s:iterator>-----用于遍歷集合
<s:if test="#list.size > 0 "></s:if>-----判斷 ActionContext.getContext().put("list", lists);
<s:elseif test="list.size > 0 "></s:elseif>
<s:else></s:else>
<s:if test="searchCondition.filter!=null">
L:
<s:label></s:label>-----只讀的標(biāo)簽
M:
<s:merge></s:merge>-----合并遍歷集合出來的值
O:
<s:optgroup></s:optgroup>-----獲取標(biāo)簽組
<s:optiontransferselect doubleList="" list="" doubleName=""></s:optiontransferselect>-----左右選擇框
P:
<s:param name="pageSize" value="pageSize"/></s:param>-----為其他標(biāo)簽提供參數(shù)
<s:password></s:password>-----密碼輸入框
<s:property value="user.name" />-----得到'value'的屬性
<s:push value=""></s:push>-----value的值push到棧中,從而使property標(biāo)簽的能夠獲取value的屬性
R:
<s:radio name="type" list="#{0:'拍賣會(huì)',1:'展會(huì)'}" value="0"></s:radio>-----單選按鈕
<s:reset></s:reset>-----重置按鈕
S:
<s:select list=""></s:select>-----單選框
<s:set name=""></s:set>-----賦予變量一個(gè)特定范圍內(nèi)的值
<s:sort comparator=""></s:sort>-----通過屬性給list分類
<s:submit></s:submit>-----提交按鈕
<s:subset source="#subList" start="1" count="2">-----為遍歷集合輸出子集
<s:iterator>
<s:property/>
</s:iterator>
</s:subset>
T:
<s:tabbedPanel id=""></s:tabbedPanel>-----表格框
<s:table></s:table>-----表格
<s:text name="error"/></s:text>-----I18n文本信息
<s:textarea></s:textarea>-----文本域輸入框
<s:textfield></s:textfield>-----文本輸入框
<s:token></s:token>-----攔截器
<s:tree></s:tree>-----樹
<s:treenode label=""></s:treenode>-----樹的結(jié)構(gòu)
U:
<s:updownselect list=""></s:updownselect>-----多選擇框
<s:url value="/academy/get-detail.action?academyInfo.id=${id}"></s:url>-----創(chuàng)建url
<s:url action="search-big.action" escapeAmp="false" namespace="/problem">
<s:param name="name" value="%{'all'}"/>
<s:param name="id" value="0"/>
<s:param name="sex" value="user.sex"/>
</s:url>
JSTL語(yǔ)法及參數(shù)
JSTL包含以下的標(biāo)簽:
常用的標(biāo)簽:如<c:out>、<c:remove>、<c:catch>、<c:set>等
條件標(biāo)簽:如<c:if><c:when>、<c:choose>、<c:otherwise>等
URL標(biāo)簽:如<c:import>、<c:redirect>和<c:url>等
XML標(biāo)簽:如<xml:out>等
國(guó)際化輸出標(biāo)簽:如<fmt:timeZone>等
SQL標(biāo)簽:如<sql:query>、<sql:update>、<sql:transaction>等
一般用途的標(biāo)簽:
1.<c:out>
沒有Body時(shí)的語(yǔ)法
<c:out value=”value” [escapeXml=”{true|false}”] [default=”defaultValue”]/>
有Body時(shí)的語(yǔ)法
<c:out value=”value” [escapeXml=”{true|false}”]>
這里是Body部分
</c:out>
名字 類型 描述
value Object 將要輸出的表達(dá)式
escapeXml boolean 確定以下字符:<,>,&,’,”在字符串中是否被除數(shù),默認(rèn)為true
default Object 如果vaule計(jì)算后的結(jié)果是null,那么輸出這個(gè)默認(rèn)值
2.<c:set>
這個(gè)標(biāo)簽用于在某個(gè)范圍(page、request、session、application等)中使用某個(gè)名字設(shè)定特定的值,或者設(shè)定某個(gè)已經(jīng)存在的javabean對(duì)象的屬性。他類似于<%request.setAttrbute(“name”,”value”);%>
語(yǔ)法1:使用value屬性設(shè)定一個(gè)特定范圍中的屬性。
<c:set value=”value” var=”varName” [scope=”{page|request|session|application}”]/>
語(yǔ)法2:使用value屬性設(shè)定一個(gè)特定范圍中的屬性,并帶有一個(gè)Body。
<c:set var=”varName” [scope=”{page|request|session|application}”]>
Body部分
</c:set>
語(yǔ)法3:設(shè)置某個(gè)特定對(duì)象的一個(gè)屬性。
<c:set value=”value” target=”target” property=”propertyName”/>
語(yǔ)法4:設(shè)置某個(gè)特定對(duì)象的一個(gè)屬性,并帶有一個(gè)Body。
<c:set target=”target” property=”propertyName”>
Body部分
</c:set>
名字 類型 描述
value Object 將要計(jì)算的表到式。
var String 用于表示value 值的屬性,如果要在其他標(biāo)簽中使用,就是通過這 個(gè)var指定的值來進(jìn)行的。它相當(dāng)于在標(biāo)簽定義了一個(gè)變量,并且這個(gè)變量只能在標(biāo)簽中的一個(gè)。
scope String var的有效范圍,可以是page|request|session|application中的一個(gè)
target String 將要設(shè)置屬性的對(duì)象,它必須是javabean或則java.util.Map對(duì)象
property Object 待設(shè)定的Target對(duì)象中的屬性名字,比如在javabean中有個(gè)name屬性,提供了setUserId方法,那么這里填userId。
3.<c:remove>
<c:remove var=”varName” [scope=”{page|request|session|application}”]/>
4.<c:catch>
這個(gè)標(biāo)簽相當(dāng)于捕獲在它里邊的標(biāo)簽拋出的異常對(duì)象
<c:catch [var=”varName”]> //var是異常的名字
內(nèi)容
</c:catch>
條件標(biāo)簽
1. <c:if>
語(yǔ)法1:無Body情況
<c:if test=”testCondition” var=”varName” [scope=”page|request|session|application”]/>
語(yǔ)法2:有Body的情況
<c:if test=”testCondition” var=”varName” [scope=”page|request|session|application”]>
Body內(nèi)容
</c:if>
名字 類型 描述
test Boolean 表達(dá)式的條件,相當(dāng)于if()中的條件判斷語(yǔ)句。
var String 表示這個(gè)語(yǔ)句的名字。
scope String var這個(gè)變量的作用范圍。
2.<c:choose>
語(yǔ)法:<c:choose>
Body內(nèi)容(<c:when>和<c:otherwise>子標(biāo)簽)
</c:choose>
注意:它的Body只能由以下元素組成:
1) 空格
2) 0或多個(gè)<c:when>子標(biāo)簽,<c:when>必須在<c:otherwise>標(biāo)簽之前出現(xiàn).
3) 0個(gè)或多個(gè)<c:otherwise>子標(biāo)簽。
<c:choose>
<c:when test="${param.age>70}">
歡迎老年人
</c:when>
<c:when test="${param.age<70 and param.age>35}">
歡迎中年人
</c:when>
<c:otherwise>
您的年齡有誤!
</c:otherwise>
</c:choose>
3.<c:when>
代表的是<c:choose>的一個(gè)條件分支,只能在<c:choose>中使用
語(yǔ)法:<c:when test=”testCondition”> //test是boolean類型,用于判斷條件真假
Body語(yǔ)句
</c:when>
4.<c:otherwise>
代表的是<c:choose>中的最后選擇。必須在最后出現(xiàn)
<c:otherwise>
內(nèi)容
</c:otherwise>
迭代標(biāo)簽
1.<c:forEach>
語(yǔ)法1:在Collection中迭代
<c:forEach[var=”varName”] items=”collection” [varStatus=”varStatusName”]
[begin=”begin”] [end=”end”] [step=”step”]
Body內(nèi)容
</c:foeEach>
語(yǔ)法2:迭代固定的次數(shù).
<c:forEach [var=”varName”] [varStatus=”varStatusName”]
[begin=”begin”] [end=”end”] [step=”step”]
Body內(nèi)容
</c:foeEach>
名字 類型 描述
var String 迭代的參數(shù),它是標(biāo)簽參數(shù),在其他標(biāo)簽中通過它來引用這個(gè)標(biāo)簽中的內(nèi)容。
Items Collection、ArrayList、 要迭代的items集合.
Iterator、Map、String、
Eunmeration等
VarStatus String 表示迭代的狀態(tài),可以訪問迭代自身的信息
Begin int 表示開始迭代的位置。
End int 表示結(jié)束迭代的位置。
Step int 表示迭代移動(dòng)的步長(zhǎng),默認(rèn)為1。
URL相關(guān)的標(biāo)簽
1.<c:import>
語(yǔ)法1:資源的內(nèi)容使用String對(duì)象向外暴露
<c:import url=”url” [context=”context”]
[var=”varName”] [scope=”{page|request|session|application}”] [charEncoding=”charEncoding”]>
內(nèi)容
</c:import>
語(yǔ)法2:資源的內(nèi)容使用Reader對(duì)象向外暴露。
<c:import url=”url” [context=”context”]
varReader=”varReaderName” [charEncoding=”charEncoding”]>
內(nèi)容
</c:import>
名字 類型 描述
url String 待導(dǎo)入資源的URL,可以是相對(duì)路徑和絕對(duì)路徑,并且可以導(dǎo)入其他主機(jī)資源
context String 當(dāng)使用相對(duì)路徑訪問外部context資源時(shí),context指定了這個(gè)資源的名字。
var String 參數(shù)的名字。
scope String var參數(shù)的作用范圍。
cahrEncoding String 輸入資源的字符編碼。
varReader String 這個(gè)參數(shù)的類型是Reader,用于讀取資源。
2.<c:redirct>
語(yǔ)法1:沒有Body的情況.
<c:redirect url=”value” [context=”context”]/>
語(yǔ)法2:有Body情況下,在Body中指定查詢的參數(shù)
<c:redirect url=”value” [context=”context”]>
<c:param name=”name” value=”value”/>
</c:redirect>
3.<c:url>
語(yǔ)法1:沒有Body
<c:url value=”value” [context=”context”] [var=”varName”] [scope=”{page|request|session+application}”]/>
語(yǔ)法2:有Body
<c:url value=”value” [context=”context”] [var=”varName”] [scope=”{page|request|session+application}”]>
<c:param name=”name” value=”value”/>
</c:url>
名字 類型 描述
value String URL值
context String 當(dāng)使用相對(duì)路徑訪問外部context資源時(shí),context指定了這個(gè)資源的名字
var String 標(biāo)識(shí)這個(gè)URL標(biāo)量。
Scope String 變量作用范圍。
SQL相關(guān)的標(biāo)簽
1.<sql:setDataSource>
2.<sql:query>
3.<sql:update>
4.<transaction>
5.<param>
posted on 2010-11-22 10:41
junly 閱讀(408)
評(píng)論(0) 編輯 收藏 所屬分類:
struts2/struts1.3/JSF