我正在尝试使用带有 jsfbean 参数的自定义 EL 函数调用方法。
<c:set var="test1" value="${cx:methodName('para')}" scope="session"/>
<h:outputText value="#{test1}"/>
我做了以下 id TLD 并将其放入 WEB-INF
<?xml version="1.0" encoding="UTF-8" ?>
<taglib
xmlns="http://java.sun.com/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-jsptaglibrary_2_1.xsd"
version="2.1">
<tlib-version>1.0</tlib-version>
<short-name>Custom_Functions</short-name>
<uri>http://example.com/functions</uri>
<function>
<name>methodName</name>
<function-class>funcionclass(Jsfbean)</function-class>
<function-signature>java.lang.String methodName(java.lang.String)</function-signature>
</function>
</taglib>
我也在 web.xml 中配置
<jsp-config>
<taglib>
<taglib-uri>http://example.com/functions</taglib-uri>
<taglib-location>/WEB-INF/functions.tld</taglib-location>
</taglib>
</jsp-config>
仍然出现 Function not found 错误。
以下是方法代码
public static String methodName(String s1) throws Exception
{
return "Kshitij";
}
任何身体都可以提供帮助。