开发者

Conditional with JSP tags

开发者 https://www.devze.com 2023-03-12 02:26 出处:网络
I\'ve got no experience with JSP tags. I\'m editing someone\'s web page (installing a plugin for a table). The table is generated with what seems to be JSP tags.

I've got no experience with JSP tags. I'm editing someone's web page (installing a plugin for a table). The table is generated with what seems to be JSP tags.

They've got:

<c:forEac开发者_Python百科h items="${row.fields}" var="rowField">
<td><c:out value="${rowField.htmlString}"/></td>
</c:forEach>

If ${rowField.htmlString} (whatever that means) is a text input box (just assume containing 'input' means it's a text box), I need to add a class to the <td>.

How? Thanks in advance.


<c:forEach items="${row.fields}" var="rowField">
    <c:choose>
        <c:when test="${fn:contains(rowField.htmlString, 'input')}">
            <td class="someClass"><c:out value="${rowField.htmlString}"/></td>
        </c:when>
        <c:otherwise>
            <td><c:out value="${rowField.htmlString}"/></td>
        </c:otherwise>
    </c:choose>
</c:forEach>
0

精彩评论

暂无评论...
验证码 换一张
取 消