您的位置:首页 > 其它

一些比较好的文章链接

2017-06-23 20:28 330 查看
hibernate 缓存机制:http://www.360doc.com/content/14/0801/16/1073512_398635409.shtml

数据库事务隔离级别及锁机制:

http://comedsh.iteye.com/blog/698733

http://blog.csdn.net/jiangwei0910410003/article/details/24960785

hibernate 关联关系映射分析:

http://lavasoft.blog.51cto.com/62575/39275

关于表单 form属性 enctype 的讲解:

http://blog.csdn.net/mazhibinit/article/details/49667511

http://blog.csdn.net/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.csdn.net/anxpp/article/details/51325838

大神博客

http://blog.csdn.net/anxpp/article/details/51235012

类的加载机制

http://www.cnblogs.com/javaee6/p/3714716.html

http://blog.csdn.net/u014338577/article/details/49968253

http://blog.csdn.net/haluoluo211/article/details/49908463
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: