📄 options.jsp
字号:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<%@ page language="java" contentType="text/html; charset=gbk" %>
<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html" %>
<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean" %>
<html:html xhtml="true" locale="true">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>Select / Options examples</title>
<html:base />
</head>
<body>
<html:form action="/processOptions">
<h2>1. Simple select tags</h2>
<table width="100%" border="0" cellspacing="10" cellpadding="0">
<tr valign="top">
<td width="33%">
<p>Single select, size="1" (drop down list)</p>
<p><html:select property="fruit1">
<html:option value="Strawberry">Strawberry</html:option>
<html:option value="Apple">Apple</html:option>
<html:option value="Orange">Orange</html:option>
<html:option value="Pear">Pear</html:option>
<html:option value="Mango">Mango</html:option>
<html:option value="Banana">Banana</html:option>
<html:option value="Pineapple">Pineapple</html:option>
</html:select></p>
</td>
<td width="33%">
<p>Single select, size="4"</p>
<p><html:select property="fruit2" size="4">
<html:option value="Strawberry">Strawberry</html:option>
<html:option value="Apple">Apple</html:option>
<html:option value="Orange">Orange</html:option>
<html:option value="Pear">Pear</html:option>
<html:option value="Mango">Mango</html:option>
<html:option value="Banana">Banana</html:option>
<html:option value="Pineapple">Pineapple</html:option>
</html:select></p>
</td>
<td width="33%">
<p>Multi-select, size="7"</p>
<p><html:select property="fruit3" size="7" multiple="true">
<html:option value="Strawberry">Strawberry</html:option>
<html:option value="Apple">Apple</html:option>
<html:option value="Orange">Orange</html:option>
<html:option value="Pear">Pear</html:option>
<html:option value="Mango">Mango</html:option>
<html:option value="Banana">Banana</html:option>
<html:option value="Pineapple">Pineapple</html:option>
</html:select></p>
</td>
</tr>
</table>
<h2>2. Populating options from arrays and collections</h2>
<table width="100%" border="0" cellspacing="10" cellpadding="0">
<tr>
<td width="33%" valign="top">
<p>Option values and labels populated from the same array:</p>
<p><html:select property="color1" size="7">
<html:options name="colors" />
</html:select>
</p>
</td>
<td width="33%" valign="top">
<p>Option values and labels populated from different arrays:</p>
<p><html:select property="color2" size="7">
<html:options name="colorCodes" labelName="colors" />
</html:select></p>
</td>
<td width="33%" valign="top">
<p>Option values populated from an array and labels populated from a
collection:</p>
<p><html:select property="color3" size="7">
<html:options name="colorCodes" labelName="colorCollection" />
</html:select></p>
</td>
</tr>
</table>
<h2>3. Populating options from a Collection of LabelValueBeans</h2>
<h2>4. Populating options from a Collection of custom beans</h2>
<table width="100%" border="0" cellspacing="10" cellpadding="0">
<tr valign="top">
<td width="33%">
<p>Options populated from a Collection of BookBeans, using<br />
<html:options>:</p>
<p><html:select property="book1" size="7">
<html:options collection="books" property="isbn"
labelProperty="title" />
</html:select></p>
</td>
<td width="33%">
<p>Options populated from a Collection of BookBeans, using<br />
<html:optionsCollection>:</p>
<p><html:select property="book2" size="7">
<html:optionsCollection name="books" value="isbn" label="title" />
</html:select></p>
</td>
<td width="33%"> </td>
</tr>
</table>
<h2>4. Populating options from a Map</h2>
<table width="100%" border="0" cellspacing="10" cellpadding="0">
<tr valign="top">
<td width="33%">
<p>Options populated from a Map, using <br />
<html:options>:</p>
<p><html:select property="animal1" size="5">
<html:options collection="animals" property="key"
labelProperty="value" />
</html:select></p>
</td>
<td width="33%">
<p>Options populated from a Map, using <br />
<html:optionsCollection>:</p>
<p><html:select property="animal2" size="5">
<html:optionsCollection name="animals" value="key" label="value" />
</html:select></p>
</td>
<td width="33%"> </td>
</tr>
</table>
<hr />
<p><html:submit />
<html:cancel />
<html:reset />
</p>
</html:form>
</body>
</html:html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -