您好,是这样的:import pojo.User; import dao.HibernateDao; import org.springframework.core.io.*; import java.io.*; public class TestAction { //DAO private HibernateDao hibernateDao; //Resource代表资源 public Resource resource; public HibernateDao getHibernateDao() { return hibernateDao; } public void setHibernateDao(HibernateDao hibernateDao) { this.hibernateDao = hibernateDao; } public Resource getResource() { //模拟资源 这里硬编 return new ClassPathResource("quartz-1.6.4.zip"); } public void setResource(Resource resource) { this.resource = resource; } public String execute() throws IOException { ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream(); org.springframework.util.FileCopyUtils.copy(getResource() .getInputStream(), byteArrayOutputStream); User user = new User(); user.setByteTest(byteArrayOutputStream.toByteArray()); hibernateDao.save(user); return "success"; } } struts.xml
标签:smartupload,jar,进度条