How to pass literal String array to jsp:attribute

103 Views Asked by At

I have a a JSP attribute in a JSP Tag file and I'm trying to pass it a literal String like {"Something", "Something else"} Is there anyway to do it?

This is the closest I've come but it doesn't work.

from test.tag

<%@ attribute name="array" rtexprvalue="true" type="java.lang.String[]" %>

from jsp

<%
    request.setAttribute("theArray", new String[] {"Something", "Something else"});
%>
<jsp:attribute name="array">${theArray}</jsp:attribute>

But the tag file still sees it as a string.

0

There are 0 best solutions below