📄 index.jsp~204~
字号:
<%@page contentType="text/html; charset=gb2312" language="java" import="java.sql.*,java.util.*,com.actionForm.FileActionForm" errorPage=""%>
<%@taglib uri="/WEB-INF/struts-html.tld" prefix="html"%>
<html:html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<link href="css/style.css" rel="stylesheet" type="text/css">
<title>利用Struts框架实现文件的上传和下载</title>
</head>
<script language="javascript" type="">
function Mycheck(){
if (fileActionForm.fileName.value=="")
{ alert("请输入上传文件的名称!");fileActionForm.fileName.focus();return false;}
if (fileActionForm.file.value=="")
{ alert("请选择上传文件的路径!");fileActionForm.file.focus();return false;}
form.submit();
}
</script>
<%
com.dao.FileDao dao=new com.dao.FileDao();
java.util.List list=dao.selectFile();
int number=list.size();//计算有多少条纪录
int row=number/3;
if(number/3!=0){
row=row+1;
}
%>
<body>
<table width="719" height="118" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td background="priture/top.jpg"> </td>
</tr>
</table>
<table width="719" height="418" border="0" align="center" cellpadding="0" cellspacing="0" background="priture/certer.jpg">
<tr>
<td width="125" > </td>
<td width="594" valign="top">
<br>
<table height="117" border="0" align="center" cellpadding="0" cellspacing="0">
<%for(int i=0;i<list.size();i++){
FileActionForm form=(FileActionForm)list.get(i);
if(i%2==0){
%>
<tr>
<td height="113">
<table width="264" height="81" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td width="115" rowspan="4" align="center"><img src="<%=form.getFilePath()%>" width="100" height="100"></td>
<td width="133" align="center">图片名称:<%=form.getFileName()%></td>
</tr>
<tr align="center">
<td>图片大小:<%=form.getFileSize()%></td>
</tr>
<tr align="center">
<td>上传日期:<%=form.getFileDate()%></td>
</tr>
<tr>
<td align="center"><a href="fileAction.do?method=downFile&path=<%=form.getFilePath()%>" ><img src="priture/bottond.jpg"></a></td>
</tr>
</table></td>
<%}else{%>
<td>
<table width="264" height="81" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td width="115" rowspan="4" align="center"><img src="<%=form.getFilePath()%>" width="100" height="100"></td>
<td width="133" align="center">图片名称:<%=form.getFileName()%></td>
</tr>
<tr align="center">
<td>图片大小:<%=form.getFileSize()%></td>
</tr>
<tr align="center">
<td>上传日期:<%=form.getFileDate()%></td>
</tr>
<tr>
<td align="center"><a href="fileAction.do?method=downFile&path=<%=form.getFilePath()%>" ><img src="priture/bottond.jpg"></a>
</td>
</tr>
</table></td>
</tr>
<%}}%>
<%if(list.size()%2==1){%>
<%}%>
</table>
<html:form action="fileAction.do?method=upLoadFile" enctype="multipart/form-data" onsubmit="return Mycheck()">
<table height="52" border="0" align="center" cellpadding="0" cellspacing="0">
<tr align="center">
<td width="60" height="26">图片名称:</td>
<td width="160"> <html:text property="fileName"/> </td>
<td width="60">图片路径:</td>
<td width="198"> <html:file property="file"/> </td>
</tr>
<tr align="right">
<td height="26" colspan="4"> <html:submit>上传</html:submit> </td>
</tr>
</table>
</html:form></td>
</tr>
</table>
<table width="719" height="34" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td background="priture/botton.jpg"> </td>
</tr>
</table>
</body>
</html:html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -