日期:2014-05-17 浏览次数:20688 次
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Insert title here</title>
<script type="text/javascript">
function openWindow(obj){
window.open('2.jsp?name=' + obj ,'_blank');
}
</script>
</head>
<body>
<%
Connection conn = null;
PreparedStatement ps = null;
ResultSet rs = null;
ArrayList list = new ArrayList();
conn = DBHelper.getMySql();
String sql="select * from format_temp";
try {
ps = conn.prepareStatement(sql);
rs = ps.executeQuery();
while(rs.next()) {
list.add(rs.getObject("name"));
}
} catch (SQLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
%>
<form action="" method="post" name="form1" id="form1">
<select name="listOption" id="list">
<%for(int i=0;i<list.size();i++){%>
<option><%=list.get(i).toString()%></option>
<%}%>
</select>
<input type="button" value="修改" onclick="openWindow(listOption)">
</form>
</body>
</html>
<body>
name:<%= request.getParameter("name").toString() %>
</body>
</html>
function openWindow(obj){
window.open('2.jsp?name=' + document.getElementById('list').value ,'_blank');
}