IllegalArgumentException when concatenating varargs and string arrays in EL

I am getting java.lang.IllegalArgumentException: wrong number of arguments

when trying to pass a string array to a method with varargs via EL. I know EL doesn't support arrays or varargs. So I wanted to pass a parameter in attribute use to the CDI bean.

The only problem seems to be (or related). Is this just not supported in EL or am I missing something?

Here's my setup:

Class with an array parameter String:

@Named
public class Test
{
    private String[] test = new String[]{"a", "b"};

    public String[] getTest()
    {
        return test;
    }

    public void setTest(String[] test)
    {
        this.test = test;
    }
}

      

A class with a method expecting varargs:

@Named
public class Method
{
    public void method(String ... args)
    {
    }
}

      

Usage in facelet:

<p:commandButton
    rendered="#{method.method(test.test)}" />

      

+3


source to share





All Articles