trainingplan_attachlist.jsp
来自「java jsp教程」· JSP 代码 · 共 150 行
JSP
150 行
<!--/jsp/plan/TrainingPlan_AttachList.jsp-->
<%@ page contentType="text/html; charset=GBK" %>
<%@ page import = "java.util.List"%>
<%@ page import = "java.util.Iterator"%>
<%@ page import = "com.icss.cnpc.plan.vo.TrainingPlanAccessoryInfo"%>
<%
String trainingno = (String)request.getAttribute("trainingno");
List trainingPlanAccessoryInfoList = (List)request.getAttribute("trainingPlanAccessoryInfoList");
%>
<html>
<head>
<title>培 训 计 划 附 件 基 本 信 息</title>
<link rel = "stylesheet" href = "<%=request.getContextPath()%>/css/style.css">
</head>
<body background = "<%=request.getContextPath()%>/images/grid.gif" topMargin = "30">
<form name = "form1" method = "post" action = "" enctype="multipart/form-data">
<input type = "hidden" name = "trainingno" value = "<%=trainingno%>">
<%--_action是操作方式,1添加,2修改备注,3删除附件--%>
<input type = "hidden" name = "_action" value = "">
<table width = "95%" border = "0" align = "center" cellspacing = "1" cellpadding = "1" bordercolordark = "#003366" bordercolordark = "#dfdfff" bgColor=#b3c4db>
<tr bgcolor="#a6d0f2" height = "30">
<th colspan = "4">培 训 计 划 附 件 基 本 信 息</th>
</tr>
<tr bgColor=#eef4ff height = "30" align = "center">
<td width = "5%"> </td>
<td width = "25%">名称</td>
<td>备注</td>
</tr>
<%
for(Iterator iter = trainingPlanAccessoryInfoList.iterator();iter.hasNext();){
TrainingPlanAccessoryInfo attachVo = (TrainingPlanAccessoryInfo)iter.next();
%>
<tr bgColor=#eef4ff height = "30" align = "center">
<td><input type = "radio" name = "accessoryId" value = "<%=attachVo.getAccessoryId()%>" onClick = "javascript:radioonClick('<%=attachVo.getMemo()%>')"></td>
<td><a href = "<%=request.getContextPath()%>/servlet/TrainingPlan_DownLoadAttachServlet?accessoryId=<%=attachVo.getAccessoryId()%>&trainingno=<%=trainingno%>"><%=attachVo.getAccessoryName()%></a></td>
<td><%if(attachVo.getMemo() == null){%><%}else{%><%=attachVo.getMemo()%><%}%></td>
</tr>
<%
}
%>
</table>
<br>
<table width = "95%" border = "0" align = "center" cellspacing = "1" cellpadding = "1" bordercolordark = "#003366" bordercolordark = "#dfdfff" bgColor=#b3c4db>
<tr bgcolor="#a6d0f2" height = "30" align = "center">
<td colspan = "2">添加附件、备注/修改备注/删除附件、备注</td>
</tr>
<tr bgColor=#eef4ff height = "30" align = "center">
<td>附件:</td>
<td><input type = "file" name = "accessoryFile" style = "width:87%" onbeforeeditfocus ="return false;" onselectstart="return false;"></td>
</tr>
<tr bgColor=#eef4ff height = "30" align = "center">
<td width = "20%">备注:</td>
<td><input type = "text" name = "accessoryMemo" size = "60%"></td>
</tr>
</table>
</form>
<center>
<img src = "<%=request.getContextPath()%>/images/add.gif" style = "cursor:hand" onClick = "javascript:addAccessoryFile('add')"></img>
<img src = "<%=request.getContextPath()%>/images/modify.gif" style = "cursor:hand" onClick = "javascript:modifyAccessoryFile('modify')"></img>
<img src = "<%=request.getContextPath()%>/images/delete.gif" style = "cursor:hand" onClick = "javascript:deleteAccessoryFile('delete')"></img>
</center>
</body>
<script language = "javascript">
function addAccessoryFile(type_operation){
if(!check_isFileNull()){
return false;
}
document.form1._action.value = type_operation;
document.form1.action = "<%=request.getContextPath()%>/servlet/TrainingPlan_MaintenanceAttachServlet";
document.form1.submit();
}
function deleteAccessoryFile(type_operation){
if(!check_radioSelect()){
return false;
}
if(!confirm("确认删除")){
return false;
}
document.form1._action.value = type_operation;
document.form1.action = "<%=request.getContextPath()%>/servlet/TrainingPlan_MaintenanceAttachServlet";
document.form1.submit();
}
function modifyAccessoryFile(type_operation){
if(!check_radioSelect()){
return false;
}
if(!check_isMemoNull()){
return false;
}
document.form1._action.value = type_operation;
document.form1.action = "<%=request.getContextPath()%>/servlet/TrainingPlan_MaintenanceAttachServlet";
document.form1.submit();
}
function check_isFileNull(){
if(document.form1.accessoryFile.value == ""){
alert("请选择要上传附件");
return false;
}
return true;
}
function check_radioSelect(){
var radioSelected = eval("document.form1.accessoryId");
if(radioSelected != null){
if(radioSelected.length){
for(var i = 0;i < radioSelected.length;i++){
if(radioSelected[i].checked){
return true;
}
}
alert("请选择要编辑的附件");
return false;
}else{
if(document.form1.accessoryId.checked){
return true;
}else{
alert("请选择要编辑的附件");
return false;
}
}
}
alert("无附件可编辑");
return false;
}
function radioonClick(memo){
document.form1.accessoryMemo.value = memo;
}
function check_isMemoNull(){
if(document.form1.accessoryMemo.value == ""){
alert("只能修改备注,请填写备注");
return false;
document.form1.accessoryMemo.focus();
}
return true;
}
</script>
</html>
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?