Using varargs in a Tag Library Descriptor
问题 Is it possible to have a TLD map to the following function: public static <T> T[] toArray(T... stuff) { return stuff; } So that I can do: <c:forEach items="${my:toArray('a', 'b', 'c')}"... I tried the following <function-signature> s java.lang.Object toArray( java.lang.Object... ) java.lang.Object[] toArray( java.lang.Object[] ) And others but nothing seems to work. 回答1: Unfortunately that's not possible. The EL resolver immediately interprets the commas in the function as separate arguments