I was wondering if we could check for all undefined
and null
variables in JSP using its built-in functions?
I know I can build a function to do that, but I need a lazy solution.
<c:if test="${name == null}">variable name is undefined</c:if>
For testing you can define and undefine a variable using:
<c:set var="name" value="Petra"/>
<c:set var="name" value="${null}"/>
To state you are using the core JSTL tags add this to the top of the page:
<%@ taglib prefix="c" uri="http://java.sun.com/jstl/core" %>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With