If else is used in most programming languages, let's briefly talk about if else and multiple condition judgments in the JSP tutorial today.
<HTML>
<HEAD>
<title>using the If statement</title>
</HEAD>
<BODY>
<%
int value = 10;
if (Value > 0)
OUT.PRINTLN ("absolute value of" + value + "=" + value);
%>
</BODY>
</HTML>
Simple contrast
<HTML>
<HEAD>
<title>using Compound statements</title>
</HEAD>
<BODY>
<%
int value = 10;
if (value > 0) {
Out.println ("The number was positive.");
OUT.PRINTLN ("absolute value of" + value + "=" + value);
}
%>
</BODY>
</HTML>
If Else
<HTML>
<HEAD>
<title>nested if statements</title>
</HEAD>
<BODY>
<%
Double value = 2;
if (value!= 0) {
if (Value > 0)
OUT.PRINTLN ("The result =" + (1/value));
Else
Out.println ("Sorry, we need a positive number.");
}
%>
</BODY>
</HTML>
Multiple conditions if Else
<HTML>
<HEAD>
<title>using an if-else ladder</title>
</HEAD>
<body>
< %
String day = "Friday";
if (day = = "Monday")
out.println ("It ' s Monday.");
Else if (day = = "Tuesday")
out.println ("It ' s Tuesday.");
Else if (day = = "Wednesday")
out.println ("It ' s Wednesday.");
Else if (day = = "Thurssday")
out.println ("It ' s Thursday.");
Else if (day = = "Friday")
out.println ("It ' s Friday.");
Else if (day = = "Saturday")
& Nbsp; out.println ("It ' S http://www.3lian.com/saturday.");
Else if (day = = "Sunday")
out.println ("It ' s Sunday.");
%>
</BODY>
Above is the three networking for you to introduce the JSP if Else statement use method, I hope to help you.