Re: JSP/EL String Concatenation
794117Jul 13 2006 — edited Jul 14 2006First to answer the question, the easiest way to contatenate things is with the <c:set> tag
<c:set var="result" value="${node.id.orgId},"/>
No special function required.
However I don't think that this will help you.
You had a problem before that the response "12" matched "1", "2" and "12" since they are all substrings of 12.
Unfortunately adding a comma to the string won't help, unless you add one on both sides.
For instance consider "1, 2, 11, 12, 13"
Looking for "1," would match both 1 and 11.
To make it work you would have to look for ",1,"
There must be a better way.
1 - consider moving this sort of logic into java code - servlet/bean/function.
It is very easy to get an array from a comma separated string (string.split() method) You could then iterate through and find a match.
JSTL is more suited for presenting data rather than processing it.
2 -
<c:forEach var="val" items="${status.value}">
<c:if test="${val == nodeId.orgId}">
// have this option be selected.
</c:if>
</c:forEach>
3 - consider turning the logic around.
Instead of looping through all the possible values in the list, loop through all the items you have selected, and match it that way.
I don't know the context you are using this in, so not sure if it applies here, but sometimes it pays to take a step back, and look at another approach.
Hope this helps,
evnafets