开发者

Conditional with 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

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜