我正在研究struts2 Hibernate,在我的项目中我将一个文本文件(普通/文本)上传到数据库,所以现在我需要从数据库中动态下载该文件,我尝试搜索所有网站,我没有得到适当的输出。 我无法继续我的项目,请帮助我。
此代码适用于struts2 Action类的上传文件:
Recruitment rc = new Recruitment();
public String saveOrUpdate() {
// String returnString = ERROR;
HttpServletRequest request = (HttpServletRequest) ActionContext.getContext().get(ServletActionContext.HTTP_REQUEST);
HttpSession session1 = request.getSession(true);
rc.setImgcontenttype(getUserImageContentType());
rc.setPhotoname(getUserImageFileName());
rc.setCandidatename1(getCandidatename());
rc.setQualificationid1(getQualificationid());
rc.setSkillid1(getSkillid());
rc.setExperience1(getExperience());
rc.setResumedate1(getResumedate());
rc.setInterviewdate1(getInterviewdate());
rc.setReference1(getReference());
rc.setResultt1(getResultt());
try {
rc.setPhotodata(FileUtils.readFileToByteArray(getUserImage()));
} catch (IOException iEx) {
iEx.printStackTrace();
}
setRphotobo(rc);
System.out.println("JJJJJJJJJJJJJJJJJJJJ " +rc.getCandidatename1());
System.out.println("imageklkkkkkkkkkkkkkkkkkkkkkkk" + rc.getImgcontenttype());
System.out.println("HHHHHHHHHHHHHHHHHHHHHHH " + rc.getPhotoname());
System.out.println("GGGGGGGGGGGGGGGGG " + rc.getPhotodata().toString());
System.out.println("Jkkk" +getUserImageFileName());
recruitmentDAO.saveOrUpdateRecruitment(rc);
return SUCCESS;
}
我正在寻找下载代码。
提前致谢