我尝试在seam 2.2中创建一个自定义el函数,方法如下http://seamframework.org/Documentation/CreatingCustomELFunctions
标签库内容为:
<?xml version="1.0"?>
<!DOCTYPE facelet-taglib PUBLIC "-//Sun Microsystems, Inc.//DTD Facelet Taglib 1.0//EN" "facelet-taglib_1_0.dtd">
<facelet-taglib>
<library-class>org.el.func.FnLibrary</library-class>
</facelet-taglib>
但是在运行时,得到以下解析错误:
SEVERE [compiler] Error Loading Library: vfszip:/home/anand/jboss-5.1.0.GA/server/default/deploy/stagebitz.ear/stagebitz.jar/META-INF/elfunctions.taglib.xml
java.io.IOException: Error parsing [vfszip:/home/anand/jboss-5.1.0.GA/server/default/deploy/stagebitz.ear/stagebitz.jar/META-INF/elfunctions.taglib.xml]:
Caused by: org.xml.sax.SAXException: Error Handling [vfszip:/home/anand/jboss-5.1.0.GA/server/default/deploy/stagebitz.ear/stagebitz.jar/META-INF/elfunctions.taglib.xml@4,57] <library-class>
at com.sun.facelets.compiler.TagLibraryConfig$LibraryHandler.endElement(TagLibraryConfig.java:271)
使用JSF 1.2
在web.xml中使用以下参数。
<context-param>
<param-name>javax.faces.FACELETS_LIBRARIES</param-name>
<param-value>
/WEB-INF/elfunctions.taglib.xml
</param-value>
</context-param>
映射isEmpty的示例:
<!DOCTYPE facelet-taglib PUBLIC
"-//Sun Microsystems, Inc.//DTD Facelet Taglib 1.0//EN"
"http://java.sun.com/dtd/facelet-taglib_1_0.dtd">
<facelet-taglib>
<namespace>yournamespace</namespace>
<function>
<function-name>functionname</function-name>
<function-class>fullclanmae</function-class>
<function-signature>java.lang.Boolean isEmpty(java.util.Set)</function-signature>
</function>
</facelet-taglib>
把它放在你的类路径中,它将与web.xml中的任何内容一起工作