JSTL If Example
Keywords : JSTL If, JSTL If Example, JSTL If Tag Example, JSTL c:if tag Example,JSTL If Example explains about How to use JSTL If tag in JSP for testing the conditions.
Consider an example where you need to check whether the given conditions is correct or not
JSTL If is using for evaluating a condition, which tests if the available condition is true.
It optionally exposes a Boolean scripting variable representing the outcome of this condition. Using JSTL tag ('c:if'), you can test with conditions whether it is correct or not
you can see the below example demonstrating JSTL If function which is evaluating for a condition
Tools Needed For This Example
JSTL If Example
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%> <% request.setAttribute("student", "rockey"); %> <html> <head> <title>JSTL If Example</title> </head> <body> <c:if test="${student == 'rockey' }">Hi Rockey!<br /></c:if> <c:if test="true">Hello world!</c:if> </body> </html>
Output
Hi Rockey!Hello world!
|
|