struts2標簽的定義文件 struts-tags.tld
struts2標簽的定義文件 struts-tags.tld。
在工程中使用struts2標簽
一、 struts2標簽定義文件在struts2-core-2.0.11.1META-INF 下面,文件名為struts-tags.tld
二、 如果工程使用了servlet2.3規范,要做兩件事,就能在工程中使用struts2標簽了
1: 在web.xml中增加標簽庫的定義
<taglib>
<taglib-uri>/struts-tags</taglib-uri>
<taglib-location>/WEB-INF/lib/struts2-core-2.0.11.1.jar</taglib-location>
</taglib>
/struts-tags 是struts2標簽庫默認的URI,建議使用這個名稱
2 在JSP中使用taglib編譯指令導入標簽庫 <%@ taglib prefix="s" uri="/struts-tags" %>
三、 如果使用servlet2.4規范,不須要在web.xml中增加標簽庫定義,只要做一件事,就行
1 在JSP中使用taglib編譯指令導入標簽庫 <%@ taglib prefix="s" uri="/struts-tags" %>
四、 struts2標簽自動提示功能(解決struts2標簽出現紅叉)
1 把struts2包中的struts-tags.tld提取出來,放入本地硬盤上,我放入了E:workspacepicbinWEB-INFtldstruts-tags.tld
2 eclipse--window--preferences 輸入TLD進行搜索 ,選擇Amateras--TLD開始添加本地TLD文件,
點Add ,URI 項輸入:/struts-tags ,Local Path項輸入:E:workspacepicbinWEB-INFtldstruts-tags.tld
點OK ,重啟eclipse 寫struts2標簽時,就有提示了,紅叉也沒了
如圖