EL expressions and string concatenation 2007-11-04 - By Adam Hardy
Back Antonio Petrelli on 04/11/07 16:17, wrote: > 2007/11/4, Adam Hardy <ahardy.struts@(protected)>: >> I want to concatenate 2 vars into a string in EL but since one is a Long, EL >> can't do it, and throws a NumberFormatException because it wants them both to be >> Longs so it can do arithmetic addition instead. > > You could set a string variable this way: > <c:set var="myStringVariable"><c:out value="${category.id}"/></c:set>
That's not quite the minimalist approach I was thinking of, but it is one approach.
Another approach which saves that whole line is to write another taglib function and use it like this:
<a href="${pc:url(pc:concat('/category/edit.html?id=', category.id))}">
where pc: is my taglibrary, but I'd like to avoid a proliferation of these taglib functions in my app.
regards Adam
-- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ------ To unsubscribe, e-mail: user-unsubscribe@(protected) For additional commands, e-mail: user-help@(protected)
|
|