Basically am using jsp:fn:split to construct an array as a parameter passed to bean.
The strings are parsed from the warning/cauation elements of the following XML:
<?xml version="1.0" encoding="UTF-8"?>
<task><caution>fs43sd</caution>
<title>aaaa<warning>fsdfas</warning></title>
<warning>asddas</warning><sbsb><warning>fsdasds</warning></sbsb>
<aaaaa>
<bbb><caution>fsdfsd243sd</caution>
<warning>fsdfsd</warning>
</bbb>
</aaaaa>
</task>
And the string array is constructed and parameterized to bean using the following JSP:
<c:set var="wids">
<x:forEach select="$output/descendant::warning" var="warning">
<x:out select="$warning" />,</x:forEach></c:set>
<c:set var="cids">
<x:forEach select="$output/descendant::caution" var="caution">
<x:out select="$caution" />,</x:forEach></c:set>
<jsp:useBean id="wc" class="main.beans.WCBean">
<jsp:setProperty name="wc" property="wids" value="${fn:split(wids, ',')}"/>
<jsp:setProperty name="wc" property="cids" value="${fn:split(cids, ',')}"/>
</jsp:useBean>
And when I print the constructed array using <c:forEach items="${fn:split(wids, ',')}" var="entry">${entry},</c:forEach>:
fsdfas,
asddas,
fsdasds,
fsdfsd,
Note that line breaks are appended to the end of each value. Any thought?
Tried to delete the line break preceding the select and its gone. Guess c:set is treating whatever not jsp tag inside as string literal.
The line breaks are copied faithfully from those in your XML inside the c:set element.