一些比较好的文章链接

hibernate 缓存机制:http://www.360doc.com/content/14/0801/16/1073512_398635409.shtml

数据库事务隔离级别及锁机制:
http://comedsh.iteye.com/blog/698733
http://blog.youkuaiyun.com/jiangwei0910410003/article/details/24960785

hibernate 关联关系映射分析:
http://lavasoft.blog.51cto.com/62575/39275

关于表单 form属性 enctype 的讲解:
http://blog.youkuaiyun.com/mazhibinit/article/details/49667511
http://blog.youkuaiyun.com/xiaojianpitt/article/details/6856536

当进行结合spring mvc进行文件上传时,此时form 属性enctype =‘multipart/form-data’,在controller中

@Controller
public class TransReqController {
        @Autowired
        private HttpServletRequest request;

        @Autowired
        private ReqProductService reqproductService;

        @Autowired
        private TransreqService transreqService;

        @Autowired
        private TransreqDao transreqDao;

        @RequestMapping(value="/doPublish.action")
        @ResponseBody
        public Map<String,String> doPublish(@RequestParam(value = "imgfile", required = false) CommonsMultipartFile[] files,**HttpServletRequest request**){
            boolean resultflag=true;

            Map<String,String> map = new HashMap<String, String>();
            User user = (User) request.getSession().getAttribute("user");
            String imgUri = "";
                for(int i=0;i<files.length;i++){//上传图片
                    CommonsMultipartFile file = files[i];
                    String origfilename = file.getOriginalFilename();
                    if(!DataUtil.isNullStr(origfilename)){
                        boolean flag = true;
                        String s= renameFileName(origfilename,user.getUserName());
                        try {
                            if(!QiniuUtil.upload(file.getBytes(), s)){
                                flag=false;
                            }
                        } catch (QiniuException e) {
                            Logger.getLogger(TransReqController.class).error(origfilename+"上传图片到服务器发生错误");
                            flag = false;
                        }
                        if(flag){
                            imgUri+="http://"+QiniuUtil.getLinkUri()+"/"+QiniuUtil.getKey()+s+";";//保存到数据库里面的图片访问路径
                        }
                    }
                }
                Transreq transreq=null;
                try {
                    transreq = paramToTransreq(request);
                } catch (Exception e1) {
                    Logger.getLogger(TransReqController.class).error(e1.getMessage());
                    map.put(ITag.ReturnCode, "-1");
                    map.put(ITag.ErrorMessage, "发布失败");
                    return map;
                }
                ReqProduct reqproduct = paramToReqProduct(request,transreq,imgUri);
            int prdid=0;    
            try {
                prdid = transreqService.addTransreqAndProduct(transreq,reqproduct);
            } catch (Exception e) {
                Logger.getLogger(TransReqController.class).error("插入数据库失败");
                resultflag = false;
            }

            if(resultflag){
                map.put(ITag.ReturnCode, "0");
                map.put(ITag.PrdId, String.valueOf(prdid));
            }else{
                map.put(ITag.ReturnCode, "-1");
                map.put(ITag.ErrorMessage, "发布商品失败");
            }
            return map;
        }
}

要在方法里注入一个request,不要使用controller中注入的request,否则获取不到form中其他的参数,具体原因应该是方法中的request被进行过相关的处理,与以上两个链接里面说的内容有关

http://www.cnblogs.com/wangguoning/p/6109377.html
http://www.cnblogs.com/gw811/archive/2012/10/18/2730117.html
http://www.cnblogs.com/hewenwu/p/3662529.html

内存泄漏
http://blog.youkuaiyun.com/anxpp/article/details/51325838

大神博客
http://blog.youkuaiyun.com/anxpp/article/details/51235012

类的加载机制
http://www.cnblogs.com/javaee6/p/3714716.html
http://blog.youkuaiyun.com/u014338577/article/details/49968253
http://blog.youkuaiyun.com/haluoluo211/article/details/49908463

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值