当前位置: 代码迷 >> Java Web开发 >> [求助]EL自定义函数的问题。。。错在哪儿呢?
  详细解决方案

[求助]EL自定义函数的问题。。。错在哪儿呢?

热度:193   发布时间:2007-03-23 17:33:47.0
[求助]EL自定义函数的问题。。。错在哪儿呢?
运行后提示:
org.apache.jasper.JasperException: The class specified in the method signature in TLD for the function Greeting:greet cannot be found.

文件greeting.jsp:
<%@ page contentType="text/html; charset=GBK"%>
<%@ taglib prefix="Greeting"uri="/myGreeting"%>
<html>
<body>
${Greeting:greet()}
</body>
</html>

文件web.xml
<taglib>
<taglib-uri>
/myGreeting
</taglib-uri>
<taglib-location>
/WEB-INF/taglib.tld
</taglib-location>
</taglib>

文件taglib.tld
<?xml version="1.0" encoding="UTF-8"?>
<taglib xmlns="http://java.sun.com/xml/ns/j2ee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee/web-jsptaglibrary_2_0.xsd http://java.sun.com/xml/ns/j2ee"
version="2.0">
<tlib-version>1.1</tlib-version>
<jsp-version>2.0</jsp-version>
<short-name>Greeting</short-name>
<uri>/myGreeting</uri>
<function>
<name>greet</name>
<function-class>myFunction.Functions</function-class>
<function-signature>java.lang.String sayHello()</function-signature>
</function>
</taglib>

WEB-INF/classes/myFunction中有Functions.class
搜索更多相关主题的帖子: 函数  定义  web  Greeting  

----------------解决方案--------------------------------------------------------
<?xml version="1.0" encoding="UTF-8"?>
<taglib xmlns="http://java.sun.com/xml/ns/j2ee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee/web-jsptaglibrary_2_0.xsd http://java.sun.com/xml/ns/j2ee"
version="2.0">
<tlib-version>1.1</tlib-version>
<short-name>Greeting</short-name>
<uri>myGreeting</uri>
<function>
<name>greet</name>
<function-class>myFunction.Functions</function-class>
<function-signature>java.lang.String sayHello()</function-signature>
</function>
</taglib>

----------------解决方案--------------------------------------------------------

不行啊 修改后还是同样的错误


----------------解决方案--------------------------------------------------------
回复:(xinqing12312)[求助]EL自定义函数的问题。。...

<?xml version="1.0" encoding="UTF-8"?>
<taglib xmlns="http://java.sun.com/xml/ns/j2ee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee/web-jsptaglibrary_2_0.xsd http://java.sun.com/xml/ns/j2ee"
version="2.0">
<tlib-version>1.1</tlib-version>
<jsp-version>2.0</jsp-version>
<short-name>Greeting</short-name>
<uri>/myGreeting</uri>
<function>
<name>greet</name>
<function-class>myFunction.Functions</function-class>
<function-signature>java.lang.String sayHello()</function-signature>
</function>
</taglib>
中的
<short-name>Greeting</short-name>
换成其他的名称看


----------------解决方案--------------------------------------------------------
  相关解决方案