真实的国产乱ⅩXXX66竹夫人,五月香六月婷婷激情综合,亚洲日本VA一区二区三区,亚洲精品一区二区三区麻豆

成都創(chuàng)新互聯(lián)網(wǎng)站制作重慶分公司

關(guān)于使用ajaxfileupload來(lái)上傳file文件的若干總結(jié)

最近在做文件上傳的時(shí)候看到ajaxfileupload來(lái)做文件的上傳,感覺(jué)很有意思。記錄下來(lái)方便以后在做相關(guān)的功能是自己查閱。

武鳴網(wǎng)站建設(shè)公司成都創(chuàng)新互聯(lián),武鳴網(wǎng)站設(shè)計(jì)制作,有大型網(wǎng)站制作公司豐富經(jīng)驗(yàn)。已為武鳴上千家提供企業(yè)網(wǎng)站建設(shè)服務(wù)。企業(yè)網(wǎng)站搭建\外貿(mào)網(wǎng)站建設(shè)要多少錢(qián),請(qǐng)找那個(gè)售后服務(wù)好的武鳴做網(wǎng)站的公司定做!

jsp頁(yè)面

<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>

<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>

<%

String path = request.getContextPath();

String basePath = request.getScheme() + "://"

+ request.getServerName() + ":" + request.getServerPort()

+ path + "/";

%>

上傳印章

rel="stylesheet" type="text/css" />

<% String userid=(String)request.getAttribute("userid");

  String id=(String)request.getAttribute("id");

%>

<%-- 編輯印章信息--%>

id="form1" name="form1">

印章編號(hào):

印章類(lèi)型:

印章刻文:

使用年限:

數(shù)字證書(shū):

type="file" />

印章文件:

type="file" />

開(kāi)始日期:

結(jié)束日期:

持章人姓名:

手機(jī)號(hào)碼:

郵箱:

key:

持章人***:

上傳***:

證書(shū)類(lèi)型:

>

/>

/>

action層只要代碼代碼

public class SealManagerAction{

private static final long serialVersionUID = 1L;

private static final Logger log = Logger.getLogger(SealManagerAction.class);

private ISealManagerService sealManagerService;

//private PageBean pageBean = new PageBean();

//private MinicollectSeals minicollectSeals;

private ISealUserService sealUserService;

private ISealinfoService sealinfoService;

private File sealfile;// 印章文件

private String sealfileFileName;

private File signfile;// 數(shù)字簽名證書(shū)

private String signfileFileName;

private File idfile;// 個(gè)人***

private String idfileFileName;

private Sealinfo sealinfo;

private Sealuser sealuser;

..............

public void saveEditSeal() {

try {

Sealinfo sealinfo1 = new Sealinfo();

User user = (User) request.getSession().getAttribute("loginUser");

Sealinfo sealinfo2=sealinfoService.findSealinfoByInventory(sealinfo.getInventory());

if (sealinfo2!=null) {

sealinfo2.setUserid(sealinfo.getUserid());

sealinfo2.setApplytype(sealinfo.getApplytype());

sealinfo2.setCertype(sealinfo.getCertype());

sealinfo2.setContent(sealinfo.getContent());

sealinfo2.setEmail(sealinfo.getEmail());

sealinfo2.setEnd(sealinfo.getEnd());

sealinfo2.setIdno(sealinfo.getIdno());

sealinfo2.setIndate(sealinfo.getIndate());

sealinfo2.setPhone(sealinfo.getPhone());

sealinfo2.setSealno(sealinfo.getSealno());

sealinfo2.setSealusername(sealinfo.getSealusername());

sealinfo2.setStart(sealinfo.getStart());

sealinfo2.setType(sealinfo.getType());

sealinfo2.setUsbkey(sealinfo.getUsbkey());

sealinfo2.setInventory(sealinfo.getInventory());

sealinfoService.addSealinfo(sealinfo2);

} else {

sealinfo1.setUserid(sealinfo.getUserid());

sealinfo1.setApplytype(sealinfo.getApplytype());

// sealinfo1.setCerpath(cerpath)

sealinfo1.setCertype(sealinfo.getCertype());

sealinfo1.setContent(sealinfo.getContent());

sealinfo1.setEmail(sealinfo.getEmail());

sealinfo1.setEnd(sealinfo.getEnd());

sealinfo1.setIdno(sealinfo.getIdno());

sealinfo1.setIndate(sealinfo.getIndate());

sealinfo1.setPhone(sealinfo.getPhone());

sealinfo1.setSealno(sealinfo.getSealno());

sealinfo1.setSealusername(sealinfo.getSealusername());

sealinfo1.setStart(sealinfo.getStart());

sealinfo1.setType(sealinfo.getType());

sealinfo1.setUsbkey(sealinfo.getUsbkey());

sealinfo1.setInventory(sealinfo.getInventory());

sealinfoService.addSealinfo(sealinfo1);

}

/*

* String id=sealinfo.getId(); Gson gson = new

* GsonBuilder().setDateFormat("yyyy-MM-dd").create(); String

* outString=gson.toJson(sealinfo);

*/

response.getWriter().print(true);

} catch (Exception e) {

// TODO Auto-generated catch block

e.printStackTrace();

log.error(e.getMessage());

}

}

public void saveEditSealFile() {

String idno = request.getParameter("id");

String sealpath = UploadConfigurationRead.getInstance().getConfigItem(

"uploadSealFilePath").trim();

String signpath = UploadConfigurationRead.getInstance().getConfigItem(

"uploadSignFilePath").trim();

String idpath = UploadConfigurationRead.getInstance().getConfigItem(

       "uploadIdFilePath").trim();

try {

Sealinfo sealinfo = sealinfoService.findSealinfo(idno);

//Sealuser sealuser = sealinfo.getSealuser();

if(sealfile!=null&&sealfile.length()>0){

File xmlFile = uploadXmlFile(sealpath, sealinfo.getId(), sealfile);

sealpath = sealXMLParse(xmlFile,sealpath,sealinfo.getId());

// if(xmlFile.exists()){

// xmlFile.delete();

// }

sealinfo.setSealpath(sealpath);

}

if(signfile!=null&&signfile.length()>0){

signpath = uploadFile(signpath, sealinfo.getSealno()

+ signfileFileName.substring(signfileFileName.lastIndexOf(".")), signfile);

sealinfo.setCerpath(signpath);

}

if(idfile!=null&&idfile.length()>0){

idpath = uploadFile(idpath, sealinfo.getSealno()

+ idfileFileName.substring(idfileFileName.lastIndexOf(".")), idfile);

sealinfo.setIdpath(idpath);

}

//sealUserService.save(sealuser);

sealinfoService.addSealinfo(sealinfo);

response.getWriter().print(true);

} catch (IOException e) {

// TODO Auto-generated catch block

e.printStackTrace();

log.error(e.getMessage());

} catch (Exception e) {

// TODO Auto-generated catch block

e.printStackTrace();

log.error(e.getMessage());

}

}

public String uploadFile(String directory, String filename, File file)

throws IOException {

String fiePath = directory + File.separator + filename;

File target = new File(fiePath);

FileUtils.copyFile(file, target);

return fiePath;

}

public File uploadXmlFile(String directory,String filename,File file) throws IOException{

File target = new File(directory + File.separator + filename + ".xml");

FileUtils.copyFile(file, target);

return target;

}

}


本文題目:關(guān)于使用ajaxfileupload來(lái)上傳file文件的若干總結(jié)
轉(zhuǎn)載注明:http://weahome.cn/article/goedgc.html

其他資訊

在線咨詢

微信咨詢

電話咨詢

028-86922220(工作日)

18980820575(7×24)

提交需求

返回頂部