jsp如何将数组中的数据添加到下拉菜单中



jsp如何将数组中的数据添加到下拉菜单中,最近我开发jsp项目的时候就遇到了这个问题,以下将为大家讲解怎么样可以把数组添加到下拉菜单中,以下就是jsp源码:

<%@ page contentType=”text/html; charset=gb2312″ language=”java” import=”java.sql.*” errorPage=”" %>
<html>
<head>
<meta http-equiv=”Content-Type” content=”text/html; charset=gb2312″>
<title>将数组中的数据添加到下拉菜单中</title>
</head>

<body>
<form name=”form1″ method=”post” action=”">
<table width=”279″ height=”252″ border=”0″ align=”center” cellpadding=”0″ cellspacing=”0″>
<tr>
<td width=”279″ background=”images/1.gif”><table width=”235″ height=”69″ border=”0″ align=”center” cellpadding=”0″ cellspacing=”0″>
<tr>
<td height=”21″ align=”center”><select name=”select”>
<%
String type[]={“JSP网站开发全书”,”案例开发集锦”,”专家门诊开发答疑”,”JSP相关数据库技术”,”计算机应用技术”};
for(int i=0;i<type.length;i++){
%>
<option value=”<%=type[i]%>”><%=type[i]%></option>
<%}%>
</select></td>
</tr>
<tr>
<td height=”120″>&nbsp;</td>
</tr>
</table></td>
</tr>
</table>

</form>
</body>
</html>

大家可以将上述将数组中的数据添加到下拉菜单的jsp源码放置你的项目中去。希望可以给您带来帮助。