EL Exception on JSP when passing arguments to liferay-ui:message

1.9k views Asked by At

So Im trying to use this line on my JSP:

<liferay-ui:message key='test.mymessage' arguments='${number}'/>

test.mymessage = Number is {0}

And i am getting this error:

javax.el.ELException: No puedo convertir 10 desde tipo class java.lang.Integer a class [Ljava.lang.Object;

which roughly translates to:

javax.el.ELException: Can't convert 10 from type class java.lang.Integer to class [Ljava.lang.Object;

I even tried:

<liferay-ui:message key='test.mymessage' arguments='10'/>

Odd thing is, this has worked forever and started failing just a few days ago, and some of my work mates can run this jsp without a problem. What is the problem here?

1

There are 1 answers

2
Parkash Kumar On

As described in Arguments in liferay-ui:message

The tag accepts an attribute named 'arguments' of type Object [].

Therefore the following snippet should work:

Passing argument through scriptlet: (If you are passing single argument)

<liferay-ui:message key="test.mymessage" arguments="<%=number %>" />

OR

Passing argument through EL:

<%
    Integer[] arguments = new Integer[]{number};
%>
<liferay-ui:message key='test.mymessage' arguments='${arguments}' />