I want to export this function to custom-functions.tld
:
package com.site.vo; public class Utils { public static String concat(String... values) { String out = ""; for (String value : values) { out.concat(value); } return out; } }
Here is my custom-functions-tld
file:
<?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 http://java.sun.com/xml/ns/j2ee/web-jsptaglibrary_2_0.xsd" version="2.0"> <tlib-version>2.0</tlib-version> <uri>/WEB-INF/custom-functions.tld</uri> <function> <description>Concatenate strings</description> <name>concat</name> <function-class>com.site.vo.Utils</function-class> <function-signature>java.lang.String concat(java.lang.String...)</function-signature> </function> </taglib>
That function-signature
did not work, I got the following exception:
org.apache.jasper.JasperException: The class java.lang.String... specified in the method signature in TLD for the function f:concat cannot be found. java.lang.String...
Tried java.lang.String[]
, but it expects only one parameter (list, d'oh!). I am looking for the right signature function to export functions with multiple parameters.
Thank you in advance!
source share