TestSelectOptionTag.jsp
资源名称:某公司的java培训教材 [点击查看]
上传用户:dinglihq
上传日期:2013-02-04
资源大小:99958k
文件大小:2k
源码类别:
Java编程
开发平台:
Java
- <%-- Page Directives --%>
- <%@ page session="false" errorPage="Error.jsp" %>
- <%-- Taglib Directives --%>
- <%@ taglib uri="/bibleTags" prefix="bible" %>
- <html>
- <head>
- <title>Test Select Option Tag</title>
- </head>
- <body>
- <%@ include file="Header.jsp" %>
- <h3>SelectOption with single value</h3>
- <%-- Set color for testing purpose only --%>
- <% String color = "2"; %>
- Color:
- <select name="color">
- <bible:selectOption value="<%= color %>">
- <option value="0">--Select One--</option>
- <option value="1">Red</option>
- <option value="2">Green</option>
- <option value="3">Blue</option>
- <option value="4">Yellow</option>
- <option value="5">Orange</option>
- </bible:selectOption>
- </select>
- (value selected = <%= color %>)
- <h3>SelectOption with multiple values</h3>
- <%-- Set colors for testing purpose only --%>
- <%
- String[] colors = new String[2];
- colors[0] = "1";
- colors[1] = "4";
- %>
- Colors:
- <select name="colors" size="6" multiple>
- <bible:selectOption value="<%= colors %>">
- <option value="0">--Select Multiple--</option>
- <option value="1">Red</option>
- <option value="2">Green</option>
- <option value="3">Blue</option>
- <option value="4">Yellow</option>
- <option value="5">Orange</option>
- </bible:selectOption>
- </select>
- (values selected =
- <%
- boolean needComma = false;
- for (int i = 0; i < colors.length; i++) {
- if (needComma) out.print(", ");
- out.print(colors[i]);
- needComma = true;
- } %>
- )
- <br><br>
- <%@ include file="Footer.htm" %>
- </body>
- </html>