<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Lucky Number Advisor</title>
</head>
<body>
<%
int luckyNumber = (new java.util.Random()).nextInt(12) + 1;
// The value will be in the range between 1 (inclusive) to 12 (inclusive)
pageContext.setAttribute("luckyN", "" + luckyNumber);
// set luckyNumber as a page scope variable named luckyN
%>
<h2>Don't Forget to consult me before stepping out from your house</h2>
Hello ! Your Lucky Number today is ${luckyN}.
<%-- Add in your codes here to complete the page and display the
expected message --%>
<c:if test="${luckyN=='1'}">
your lucky number is 1 which is an odd number
</c:if>
</body></html>
How do i enter the if tag so that if the ramdom number = 1 it will display a message "your lucky number is 1 which is an odd number" and when ramdom number = 12 it will display a message "your lucky number is 12 and is an even number". I think i got the if tag format wrong


Reply With Quote