if else在大部份編程語言中都是這樣使用的
<HTML>
<HEAD>
<TITLE>Using the if Statement</TITLE>
</HEAD>
<BODY>
<H
<%
int value =
if(value >
out
%>
</BODY>
</HTML>
簡單對比
<HTML>
<HEAD>
<TITLE>Using Compound Statements</TITLE>
</HEAD>
<BODY>
<H
<%
int value =
if(value >
out
out
}
%>
</BODY>
</HTML>
if else
<HTML>
<HEAD>
<TITLE>Nested if Statements</TITLE>
</HEAD>
<BODY>
<H
<%
double value =
if (value !=
if (value >
out
else
out
}
%>
</BODY>
</HTML>
多個條件if else
<HTML>
<HEAD>
<TITLE>Using an if
</HEAD>
<BODY>
<H
<%
String day = "Friday";
if(day == "Monday")
out
else if (day == "Tuesday")
out
else if (day == "Wednesday")
out
else if (day == "Thurssday")
out
else if (day == "Friday")
out
else if (day == "Saturday")
out
else if (day == "Sunday")
out
%>
</BODY>
</HTML>
以上是網為您介紹的jsp if else語句使用方法
From:http://tw.wingwit.com/Article/program/Java/JSP/201311/20495.html