關(guān)于struts中tld 文件里配置詳解
Posted on 2007-01-13 10:17 泰仔在線 閱讀(6177) 評(píng)論(2) 編輯 收藏 所屬分類: Java 相關(guān)這是struts-bean.tld 中write的配置:
<tag>
<name>write</name>
<tagclass>org.apache.struts.taglib.bean.WriteTag</tagclass>
<bodycontent>empty</bodycontent>
<attribute>
<name>bundle</name>
<required>false</required>
<rtexprvalue>true</rtexprvalue>
</attribute>
<attribute>
<name>filter</name>
<required>false</required>
<rtexprvalue>true</rtexprvalue>
</attribute>
<attribute>
<name>format</name>
<required>false</required>
<rtexprvalue>true</rtexprvalue>
</attribute>
<attribute>
<name>formatKey</name>
<required>false</required>
<rtexprvalue>true</rtexprvalue>
</attribute>
<attribute>
<name>ignore</name>
<required>false</required>
<rtexprvalue>true</rtexprvalue>
</attribute>
<attribute>
<name>locale</name>
<required>false</required>
<rtexprvalue>true</rtexprvalue>
</attribute>
<attribute>
<name>name</name>
<required>true</required>
<rtexprvalue>true</rtexprvalue>
</attribute>
<attribute>
<name>property</name>
<required>false</required>
<rtexprvalue>true</rtexprvalue>
</attribute>
<attribute>
<name>scope</name>
<required>false</required>
<rtexprvalue>true</rtexprvalue>
</attribute>
</tag>
</taglib>
其中:
<name>write</name>:這個(gè)Tag的名字
<tagclass>org.apache.struts.taglib.bean.WriteTag</tagclass>:這個(gè)Tag是由那個(gè)類實(shí)現(xiàn)的(這個(gè)class可以在struts.jar包中找到)
<bodycontent>empty</bodycontent>:這個(gè)Tag可以直接結(jié)尾,不需要填寫內(nèi)容
這里bodycontent有三個(gè)可選值
jsp 標(biāo)簽體由其他jsp元素組成
如果其有jsp元素,那么標(biāo)簽會(huì)先解釋,然后將元素的實(shí)際值傳入。比如標(biāo)簽體里含有<%=attributeName%>這樣子的jsp元素,此時(shí)標(biāo)簽會(huì)按attributeName的實(shí)際值是什么就傳入什么。這個(gè)是最常用的一個(gè)。
empty 標(biāo)簽體必須為空
在引用這個(gè)Tag的時(shí)候,可以<bean:write bundle="attributeName" />,而不必<bean:write bundle="attributeName" ></bean:write>
tagdependent 由標(biāo)簽解釋,不帶jsp轉(zhuǎn)換
<attribute> </attribute>這里標(biāo)識(shí)的是這個(gè)Tag的一個(gè)參數(shù)
<name>bundle</name>這個(gè)參數(shù)的名字
<required>false</required>這個(gè)參數(shù)是否是必填相
如果為true則必須寫這個(gè)參數(shù),否則會(huì)報(bào)錯(cuò)
<rtexprvalue>true</rtexprvalue>是說(shuō)這個(gè)標(biāo)簽的值可以寫入
rtexprvalue:"RUN-TIME EXPRESSION VALUE",是否可以動(dòng)態(tài)賦值,在jsp中如value="<%=attributeName%>"
<tag>
<name>write</name>
<tagclass>org.apache.struts.taglib.bean.WriteTag</tagclass>
<bodycontent>empty</bodycontent>
<attribute>
<name>bundle</name>
<required>false</required>
<rtexprvalue>true</rtexprvalue>
</attribute>
<attribute>
<name>filter</name>
<required>false</required>
<rtexprvalue>true</rtexprvalue>
</attribute>
<attribute>
<name>format</name>
<required>false</required>
<rtexprvalue>true</rtexprvalue>
</attribute>
<attribute>
<name>formatKey</name>
<required>false</required>
<rtexprvalue>true</rtexprvalue>
</attribute>
<attribute>
<name>ignore</name>
<required>false</required>
<rtexprvalue>true</rtexprvalue>
</attribute>
<attribute>
<name>locale</name>
<required>false</required>
<rtexprvalue>true</rtexprvalue>
</attribute>
<attribute>
<name>name</name>
<required>true</required>
<rtexprvalue>true</rtexprvalue>
</attribute>
<attribute>
<name>property</name>
<required>false</required>
<rtexprvalue>true</rtexprvalue>
</attribute>
<attribute>
<name>scope</name>
<required>false</required>
<rtexprvalue>true</rtexprvalue>
</attribute>
</tag>
</taglib>
其中:
<name>write</name>:這個(gè)Tag的名字
<tagclass>org.apache.struts.taglib.bean.WriteTag</tagclass>:這個(gè)Tag是由那個(gè)類實(shí)現(xiàn)的(這個(gè)class可以在struts.jar包中找到)
<bodycontent>empty</bodycontent>:這個(gè)Tag可以直接結(jié)尾,不需要填寫內(nèi)容
這里bodycontent有三個(gè)可選值
jsp 標(biāo)簽體由其他jsp元素組成
如果其有jsp元素,那么標(biāo)簽會(huì)先解釋,然后將元素的實(shí)際值傳入。比如標(biāo)簽體里含有<%=attributeName%>這樣子的jsp元素,此時(shí)標(biāo)簽會(huì)按attributeName的實(shí)際值是什么就傳入什么。這個(gè)是最常用的一個(gè)。
empty 標(biāo)簽體必須為空
在引用這個(gè)Tag的時(shí)候,可以<bean:write bundle="attributeName" />,而不必<bean:write bundle="attributeName" ></bean:write>
tagdependent 由標(biāo)簽解釋,不帶jsp轉(zhuǎn)換
<attribute> </attribute>這里標(biāo)識(shí)的是這個(gè)Tag的一個(gè)參數(shù)
<name>bundle</name>這個(gè)參數(shù)的名字
<required>false</required>這個(gè)參數(shù)是否是必填相
如果為true則必須寫這個(gè)參數(shù),否則會(huì)報(bào)錯(cuò)
<rtexprvalue>true</rtexprvalue>是說(shuō)這個(gè)標(biāo)簽的值可以寫入
rtexprvalue:"RUN-TIME EXPRESSION VALUE",是否可以動(dòng)態(tài)賦值,在jsp中如value="<%=attributeName%>"