Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

JSTL Expression for test if Not

I am trying to know whether certain text starts with an expression "Service include.." using JSTL condition. However, I see that this expression is incorrect and error some. Can you please identify what is wrong with this.

Below is part of JSP page.

<%--  
    Attributes: ruleView
    RuleViewDto ruleView
--%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<c:set var="ruleDesc" value="${rule.description}"/>

<c:if test="${!fn:startsWith(ruleDesc, 'Service include')}">        

    <td align="right"  class="imgButton"
        onclick="RuleSet.removeRule('${ruleView.stepId}', '${rule.code}');" style="padding-left: 10px; padding-right: 10px;" 
        ><img src="../img/delete.gif" /></td>
</c:if>

What is wrong with Expression ${!fn:startsWith(ruleDesc, 'Service include')} ? How how should it be ?

like image 214
Umesh Patil Avatar asked Jul 23 '14 12:07

Umesh Patil


1 Answers

What is wrong with Expression ${!fn:startsWith(ruleDesc, 'Service include')}

the expression itself looks good, one thing you didn't specify in the JSP is a taglib used for fn namespace. Add this taglib definition at beginning of the JSP page.

<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %>
like image 159
Roman C Avatar answered Sep 30 '22 03:09

Roman C