怎么让DW支持JSTL标签

如题所述

去https://jstl.dev.java.net/下载jstl-》JSTL Implementation 

然后解压下载的包,在META-INF有tld文件。

然后按http://floe.blogbus.com/logs/1192525.html操作,为防止连接失败,摘抄部分链接资料。

-----------------------------------------------------

DWMX2004竟然只支持JSP1,甚至不支持JSTL,这样使用JSTL的JSP页面在DW编辑器中会显得比较乱,有时同实际页面差别比较大,影响开发效率。

  解决办法:

 1 导入JSTL TAG语法定义。执行“编辑/标签库”菜单命令,导入定义JSTL的TLD文件(TLD文件可以从JSTL的jar中找到,比如jakarta的standard.jar),如图:

 

JSTL有七八个TLD,可以选择导入需要用的,我导入了c、fmt、sql、x四个TLD。导入完成后,重新启动DW,就可以在DW的代码编辑器中利用code compelete功能编写JSTL tag了,如图:

 2 实现JSTL tag的可视化显示。在Dreamweaver MX 2004\Configuration\ThirdPartyTags\Tags.xml最后添如下内容:

<!-- JSTL -->

<tagspec tag_name="c:out" tag_type="empty"  render_contents="false" is_visual="true" detect_in_attribute="true" icon="JSP.gif" icon_width="17" icon_height="15" server_model="JSP"></tagspec>

<tagspec tag_name="c:forEach" tag_type="nonempty"  render_contents="true" is_visual="false" detect_in_attribute="true" icon="JSP.gif" icon_width="17" icon_height="15" server_model="JSP"></tagspec>

<tagspec tag_name="c:if" tag_type="nonempty"  render_contents="true" is_visual="false" detect_in_attribute="true" icon="JSP.gif" icon_width="17" icon_height="15" server_model="JSP"></tagspec>

<tagspec tag_name="fmt:message" tag_type="empty"  render_contents="false" is_visual="true" detect_in_attribute="true" icon="JSP.gif" icon_width="17" icon_height="15" server_model="JSP"></tagspec>

<tagspec tag_name="fmt:formatDate" tag_type="empty"  render_contents="false" is_visual="true" detect_in_attribute="true" icon="JSP.gif" icon_width="17" icon_height="15" server_model="JSP"></tagspec>

 

重新启动DW,JSTL标签在可视化编辑区中会被显示为jsp图标,如图:

  

上面我只选择定义了常用的几个JSTL标签,如果需要其它的标签可以根据需要按照以上例子格式编写。<tagspec>的完整语法可以在DW的联机文档中查到。

  经过这样的简单改造,已经可以比较方便地使用DW开发JSTL技术页面了,不错吧。

参考资料:http://floe.blogbus.com/logs/1192525.html

温馨提示:答案为网友推荐,仅供参考