日期:2014-05-20  浏览次数:20723 次

自己写的TAG类,在WEBLOGIC8 服务器中运行出错.是什么原因?
Parsing   of   JSP   File   '/index.jsp '   failed:
--------------------------------------------
  /web/include/taglib.jsp(5):   Error   in   using   tag   library   uri= 'http://www.hiaward.com/hiaward '   prefix= 'hiaward ':   cannot   find   tag   class:   'com.hiaward.common.SubStringTag '
probably   occurred   due   to   an   error   in   /web/include/taglib.jsp   line   5:
<%@   taglib   uri= "http://www.hiaward.com/hiaward "   prefix= "hiaward "   %>  

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

如上所示,在JSP中引入了一个自定义的TAG,在TOMCAT   下运行无误,迁移到WEBLOGIC8中,出现如上的问题.有几点说明一下:

1、 'com.hiaward.common.SubStringTag '是存在的,放在“WEB-INF/classes/目录下。
2、WEB。XML文件放在WEB-INF/目录下,
<taglib>
<taglib-uri> http://www.hiaward.com/hiaward </taglib-uri>
<taglib-location>
/WEB-INF/config/tlds/hiaward.tld
</taglib-location>
</taglib>
3、hiaward.tld   文件在“/WEB-INF/config/tlds/”文件夹下面。

大家知道是什么原因吗???




------解决方案--------------------
没用过这个
帮你顶
------解决方案--------------------
在JSP文件上面写如下指令,然后不用在web.xml里写任何配置

<%@ taglib prefix= "hiaward " uri= "/WEB-INF/config/tlds/hiaward.tld "%>

在hiaward.tld里写标签名,标签执行类和需要的参数,如下例:

<?xml version= "1.0 " encoding= "ISO-8859-1 "?>
<!DOCTYPE taglib PUBLIC
"-//Sun Microsystems, Inc.//DTD JSP Tag Library 1.2//EN "
"http://java.sun.com/dtd/web-jsptaglibrary_1_2.dtd ">
<taglib>
<tlib-version> 1.0 </tlib-version>
<jsp-version> 1.2 </jsp-version>
<short-name> </short-name>
<description> </description>
<tag>
<name> tagName </name> <!--这里写你的TAG的名字-->
<tag-class> com.xxx.Xxxx </tag-class> <!--TAG执行的类-->
<attribute>
<name> attributeName </name> <!--需要的属性名-->
<required> true </required> <!--属性是否必须-->
<rtexprvalue> true </rtexprvalue> <!--这个标签我不知道是干嘛的,上网查一下-->
</attribute>
</tag>
</taglib>

就可以在JSP中直接用了:

<hiaward:tagName attributeName= "attributeValue "/>