gpt4 book ai didi

java - 用于测试 if Not 的 JSTL 表达式

转载 作者:搜寻专家 更新时间:2023-11-01 01:26:11 24 4
gpt4 key购买 nike

我想知道某些文本是否以表达式“Service include..”开头,使用 JSTL 条件。但是,我看到这个表达式不正确并且有一些错误。能否请您确定这是哪里出了问题。

下面是JSP页面的一部分。

<%--  
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>

表达式 ${!fn:startsWith(ruleDesc, 'Service include')} 有什么问题?应该如何?

最佳答案

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

表达式本身看起来不错,您没有在 JSP 中指定的一件事是用于 fn 命名空间的标记库。在 JSP 页面的开头添加此 taglib 定义。

<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %>

关于java - 用于测试 if Not 的 JSTL 表达式,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24910120/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com