On my current page I am using JSTL to check if data is available for my form. Problem I am facing is “if there is no data I am not seeing the text fields either”. I can solve it using and tags but that would entail lot of if else if else kind of code all through the page. Can anyone suggest me a better cleaner solution to this problem?
<c:if test="${salesData!=null}">
<c:if test="${fn:length(salesBundle.salesArea) > 0}">
<input type="text" id="sales_area" class="salesManagerStyle">
</c:if>
</c:if>
You can have multiple conditions in a
test.But you can also use the
emptykeyword to do both a nullcheck and lengthcheck.That’s the best what you can get, now. If you need to reuse the same condition elsewhere in the page, then you could also save it by
<c:set>.