struts 将上传文件保存到数据库中

1、在实体类中声明一个byte[] ;

2、在控制层(action)中将文件读取出来转换为FormFile,通过getFileDate方法存储到字节数组中。

3、在hibernate配置文件中为字节数组的字段声明类型:org.springframework.orm.hibernate3.support.BlobByteArrayType

4、HibernateDao保存即可

原文地址:https://www.cnblogs.com/xinzhuangzi/p/4100463.html