Using varargs in a Tag Library Descriptor

后端 未结 4 1593
情话喂你
情话喂你 2021-01-11 17:18

Is it possible to have a TLD map to the following function:

public static  T[] toArray(T... stuff) {
    return stuff;
}

So that I

4条回答
  •  失恋的感觉
    2021-01-11 17:43

    It's a little more painful, but you could do something like this:

    class MyAddTag extends SimpleTagSupport {
        private String var;
        private Object value;
    
        public void doTag() {
            ((List) getJspContext().getAttribute(var).setValue(value);
        }
    }
    
    
    
    ...
    

提交回复
热议问题