3
我在.jsp
文件的<head>
中有此代碼。jsp上的條件語句不起作用
<script type="text/javascript">
var pageId = "<c:out value="${pageData.contentId}" />";
</script>
然後,我有這樣的:
<c:if test="${pageId eq 'how-credit-affects-interest-rate' || pageId eq 'taking-control-credit-score'}">
Display text here if conditional is true.
</c:if>
而且也試圖與or
代替||
,如果我把pageId
在瀏覽器中:
<p>
<strong>
Some text here
<br>
<c:if test="${pageId == 'how-credit-affects-interest-rate' || pageId == 'taking-control-credit-score'}">
Display text here if conditional is true.
</c:if>
</strong>
</p>
我已經做這個嘗試控制檯,我得到正確的結果,但仍然沒有得到它的工作。
爲什麼會發生這種情況?
所以,這可能是解決方案嗎? – NietzscheProgrammer
添加了一個示例來嘗試 – Taylor