Trimming a string in a JSTL expression
I have the following line in a JSP page:
<c:if test="${postAuditBean.postAudit.authority == authority.value}">
I would like to change this comparison to first trims the leading and trailing spaces from both the left and right expression before the comparison ... as in something like this:
<c:if test="${trim(postAuditBean.postAudit.authority) == trim(authority.value)}">
I've tried this:
<c:if test="${fn:trim(postAuditBean.postAudit.authority) == fn:trim(authority.value)}">
which generated a parsing error on the JSP page.
Can anyone tell me how to trim whitespace from JSTL subexpressions?
0
Graeme jones
source
to share