यदि कोई सत्र विशेषता खाली है तो मैं जेएसटीएल में परीक्षण करने की कोशिश कर रहा हूं। हालांकि विशेषता खाली है जेएसटीएल इसे एक खाली खाली विशेषता के रूप में देखता है।जेएसटीएल: जांचें कि कोई स्ट्रिंग खाली है
यह हार्डकोड है जिसे मैं जेएसटीएल के साथ बदलने की कोशिश कर रहा हूं। यह कोड सही ढंग से काम कर रहा है:
<% if (request.getAttribute("error") != null) { %>
<div class="alert alert-danger">
<strong>Oh snap, something's wrong, maybe the following error could help you out?<br /></strong>
<%= request.getAttribute("error")%>
</div>
<% } %>
इस प्रकार मैंने इसे जेएसटीएल के साथ बदल दिया। चेक किए जाने पर, त्रुटि-विशेषता खाली नहीं है, हालांकि यह खाली है।
<c:if test="${not empty sessionScope.error}">
<div class="alert alert-danger">
<strong>Oh snap, something's wrong, maybe the following error could help you out?<br /></strong>
<c:out value="${sessionScope.error}" />
</div>
</c:if>
आप JSTL पुस्तकालय – gyanu
आप पेज में JSTL टैग आयात किया है को शामिल किया है है ** <% @ टैगलिब uri = "http://java.sun.com/jsp/jstl/core" उपसर्ग = "सी"%> ** – gyanu
वास्तव में यह समस्या थी। मैं इसे एक घंटे से अधिक समय तक समस्या निवारण कर रहा था। धन्यवाद :) – DaanCelie