📄 selectpro.jsp
字号:
<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@page import="com.tb.log.model.po.Pro"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<base href="<%=basePath%>">
<title>My JSP 'selectpro.jsp' starting page</title>
<meta http-equiv="pragma" content="no-cache">
<meta http-equiv="cache-control" content="no-cache">
<meta http-equiv="expires" content="0">
<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
<meta http-equiv="description" content="This is my page">
<!--
<link rel="stylesheet" type="text/css" href="styles.css">
-->
<script type="text/javascript">
// var ob = window.dialogArguments; 此处可以接收打开页传入的参数(botton 点击时传入)
function SubMitMe(){
var selected = new Array() ;
var selectid = new Array();
var names=form1.id1; //定义数组并初始化,取所有name为id1的值
var ids = form1.id2; //定义数组并初始化,取所有name为id2的值
j=0;
for(i=0;i<names.length;i++){
if(names[i].checked == true) { //如果选择,将值取出
//取值并放入数组中
selected[j] = names[i].value; //取选择项的value
selectid[j] = ids[i].value; //取选择项的ID
j++;
}
}
var obj = new Object();
//obj中添加属性name,id 并将selected、selectid存入obj中
obj.name = selected;
obj.id = selectid;
window.returnValue=obj; //设置返回值obj
// alert("确认选择:"+obj.id);
top.close();
}
</script>
</HEAD>
<BODY>
<form name="form1">
<table border=1 width=90% cellspacing="0">
<caption>
请选择项目
</caption>
<thead>
<tr>
<td>选择</td>
<td>项目名</td>
</tr>
</thead>
<tbody>
<% List proList = (List)request.getAttribute("proList");
Pro pro = null;
for(int i=0;i<proList.size();i++){
pro = (Pro)proList.get(i);
%>
<tr>
<td><input type="checkbox" name="id1" value="<%=pro.getPro_name() %>">
<input type="hidden" name="id2" value="<%=pro.getPro_id() %>">
</td>
<td> <%=pro.getPro_name() %></td>
</tr>
<%} %>
</tbody>
<tr>
<td colspan="2">
<input type="button" value="Select" onClick="SubMitMe()"></td>
</tr>
</table>
</form>
</BODY>
</HTML>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -