switch.jsp

<%@ page contentType="text/html; charset=euc-jp" %>
<%@ taglib uri="jruntags" prefix="jrun" %>
<%
String color = request.getParameter("color");
if (color == null || color.length() == 0)
{
	color = "Red";
} 
%>
<%@ include file="html/header.html" %>
<table width="100%" cellspacing="0" cellpadding="0">
<tr><td colspan="2"><b>SWITCH & CASE タグ:</b>( <a href="html/switch_jsp.html">ソースの表示</a> )<br><br></td></tr>  
<tr>
<td width="25%" valign="top">色を選択してください。</td>
<td valign="bottom" align="left">
<form name="form1" method="get" action="switch.jsp">
<select class="basic" name="color" onchange="document.form1.submit()"> <option value="Red" <%= ("Red".equals(color) ? "selected":"") %>>赤</option> <option value="Blue" <%= ("Blue".equals(color) ? "selected":"") %>>青</option> <option value="Green" <%= ("Green".equals(color) ? "selected":"") %>>緑</option>
</select>
</form>
</td></tr>
<tr>
<jrun:switch> <jrun:case expr='<%= "Red".equals(color) %>'>
<td colspan="2" bgcolor="red"> 1. 赤<br>
</td>
</jrun:case> <jrun:case expr='<%= "Blue".equals(color) %>'>
<td colspan="2" bgcolor="blue"> 2. 青<br>
</td>
</jrun:case> <jrun:case expr='<%= "Green".equals(color) %>'>
<td colspan="2" bgcolor="green"> 3. 緑<br>
</td>
</jrun:case>
</jrun:switch>
</tr>
</table>


<%@ include file="html/footer.html" %>