| 
 | 
 
| 
 
 在工程中使用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标签时,就有提示了,红叉也没了  
 
  如图 
 
  |   
本帖子中包含更多资源
您需要 登录 才可以下载或查看,没有帐号?立即注册 
 
 
 
x
 
 
 
 
 |