首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 网站开发 > Web前端 >

附件下传

2012-08-30 
附件上传1.对应的配置文件property namefileIds typestring???meta attributefield-descriptio

附件上传

1.对应的配置文件

<property name="fileIds" type="string">
???<meta attribute="field-description">附件</meta>
???<column name="annex" />
??</property>

2,对应的数据库修改

alter table S_ART_PRODUCT add ANNEX varchar(225);

?

3.save

bean.setFileIds(bo.addAtt(thisForm.getFiles()));

?

4.update

//加入保存附件
???String ylIds="";
???try {
????ylIds = bo.updateAtt(thisForm.getFiles(), bean
??????.getFileIds(), thisForm.getRemoveFiles());
???} catch (AttachementException e) {
????generalError(request, e);
????return mapping.findForward(ADD);
???} catch (Exception e) {
????generalError(request, e);
????return mapping.findForward(FAIL);
???}
???bean.setFileIds(ylIds);

?

?

5.add页面

enctype="multipart/form-data"


<%@ taglib uri="/WEB-INF/struts-nested.tld" prefix="nested" %>

<script Language="JavaScript" src="../../script/multiAtt.js"/></script>


var fileNum=1;
?
?
<html:hidden property="removeFiles"/>


<FIELDSET>
??<LEGEND>【附件信息】</LEGEND>
??<table id="table" cellspacing="0" cellpadding="0" align="center">
???<tr>
????<td >电子版附件:</td>
????<TD colspan="3" >
?????<logic:notEmpty name="businessPracticeForm" property="bean.fileIds">
??????<logic:iterate id="id" indexId="index" name="businessPracticeForm" property="bean.fileIdss" type="java.lang.String">
???????<div id="f_<%=index%>" name="${id}">&nbsp;<a href="download.download?id=<%=id.split("\\|")[0]%>" target="_blank"><font color="red"><%=id.split("\\|")[1] %></font></a><a onclick="delF(f_<%=index %>)">删除</a></div>
??????</logic:iterate>
?????</logic:notEmpty>
?????<table border="0"><tbody id="fileTable" border="0">
?????? <tr><td property="files" name="businessPracticeForm" indexId="index">
??????? <nested:nest property="uploadFile">
???????<nested:file property="file" name="uploadFile" indexed="true" onkeydown="return false;" onchange="checkFile(this)"/>
??????? </nested:nest>
?????? </nested:iterate>
?????????? </td></tr>
?????</tbody></table>
?????&nbsp;<a href="javaScript:addDynaFileItem(this,fileNum);addFileNum();" cellspacing="0" cellpadding="0" align="center">
???<tr>
????<td >电子版附件:</td>
????<TD colspan="3" >
?????<logic:notEmpty name="businessPracticeForm" property="bean.fileIds">
??????<logic:iterate id="id" indexId="index" name="businessPracticeForm" property="bean.fileIdss" type="java.lang.String">
???????<div id="f_<%=index%>" name="${id}"><a href="download.download?id=<%=id.split("\\|")[0]%>" target="_blank"><font color="red"><%=id.split("\\|")[1] %></font></a></div>
??????</logic:iterate>
?????</logic:notEmpty>
?????<table border="0"><tbody id="fileTable" border="0">
?????? <tr><td property="files" name="businessPracticeForm" indexId="index">
??????? <nested:nest property="uploadFile">
???????<nested:file property="file" name="uploadFile" indexed="true" onkeydown="return false;" onchange="checkFile(this)"/>
??????? </nested:nest>
?????? </nested:iterate>
?????????? </td></tr>
?????</tbody></table>
?????</td>
???</tr>
??</table>
?</FIELDSET>

?

?

?

?

?

?

?

?

?

?

?

?

热点排行