我需要在JSP中執行按位測試,但不能在我的生活中弄清楚如何使用EL來完成。如何在JSTL if語句中執行按位邏輯?
我想要做的事,如:
<c:if test="${(test & testFor) == testFor}">
<h3>Test Passed</h3>
</c:if>
我當然可以用普通的JSP語法做到這一點:
<% if ((test & testFor) == testFor) { %>
<h3>Test Passed</h3>
<% } %>
進行按位測試的EL功能確實要走的路。你可以在這裏找到示例(http://stackoverflow.com/questions/3472699/jstl-fmt-library-throws-500-error-requires-sessions-enabled/3472823#3472823),[here](http:/ /stackoverflow.com/questions/2752949/jsp-2-0-seo-friendly-links-encoding/2753495#2753495)和[這裏](http://stackoverflow.com/questions/2523430/hidden-features-of- JSP-的servlet/2525995#2525995)。 – BalusC 2010-08-13 12:47:47
Thankyou非常感謝您的幫助BalusC,非常感謝。 – 2010-08-13 12:51:54
不客氣。 – BalusC 2010-08-13 16:38:55