Java Tutorial/JSP/Form Select
Версия от 17:44, 31 мая 2010; (обсуждение)
Deal with Form TextField and Select Option
index.jsp
<html>
<head>
<title>Simple Form Example</title>
</head>
<body>
<center>
<form action="simpleForm.jsp">
<table>
<tr>
<td>Name: </td>
<td><input type="Text" name="name"/></td>
</tr>
<tr>
<td>Occupation: </td>
<td><input type="Text" name="job"/></td>
</tr>
<tr>
<td>Hobbies: </td>
<td>
<select name="hobbies" multiple size="5">
<option value="Sports">Sports</option>
<option value="Cooking">Cooking</option>
<option value="Camping">Camping</option>
<option value="Reading">Reading</option>
<option value="Music">Music</option>
</select>
</td>
</tr>
</table>
<input type="submit" value="submit"/>
</form>
</center>
</body>
</html>
Read Form Multiple Selection Control
<HTML>
<HEAD>
<TITLE>Submitting Multiple Selection Select Controls</TITLE>
</HEAD>
<BODY>
<H1>Submitting Multiple Selection Select Controls<H1>
<FORM ACTION="basic.jsp" METHOD="POST">
<SELECT NAME="select1" SIZE="5" MULTIPLE>
<OPTION>Option 1</OPTION>
<OPTION SELECTED>Option 2</OPTION>
<OPTION>Option 3</OPTION>
<OPTION>Option 4</OPTION>
<OPTION>Option 5</OPTION>
</SELECT>
<BR>
<INPUT TYPE="SUBMIT" VALUE="Submit">
</FORM>
</BODY>
</HTML>
Read Form Selection Control
index.jsp
<HTML>
<HEAD>
<TITLE>Submitting Select Controls</TITLE>
</HEAD>
<BODY>
<H1>Submitting Select Controls</H1>
<FORM ACTION="basic.jsp" METHOD="POST">
<SELECT NAME="select1">
<OPTION>Option 1</OPTION>
<OPTION SELECTED>Option 2</OPTION>
<OPTION>Option 3</OPTION>
</SELECT>
<INPUT TYPE="submit" VALUE="Submit">
</FORM>
</BODY>
</HTML>