3

I am getting an java.lang.IllegalArgumentException: wrong number of arguments when trying to pass a string array to a method with varargs via EL. I know that EL does not support arrays or varargs. So I wanted to pass the parameter in use of a attribute in a CDI bean.

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

Here is my setting:

Class with String array parameter:

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

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

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

Class with method expecting varargs:

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

Use in facelet:

<p:commandButton
    rendered="#{method.method(test.test)}" />
Community
  • 1
  • 1
JavaFan
  • 65
  • 4

0 Answers0