码迷,mamicode.com
首页 > 编程语言 > 详细

spring

时间:2017-04-17 13:15:24      阅读:156      评论:0      收藏:0      [点我收藏+]

标签:shu   any   tar   action   targe   sim   out   review   tostring   

spring

spring相关

spring事物不回滚

@Transactional(rollbackFor = { Exception.class })
 public void test() {
 try {
 doDbStuff1();
 doDbStuff2();
 } catch (Exception e) {
 e.printStackTrace();
 TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();//就是这一句了,加上之后,如果doDbStuff2()抛了异常,                                                                                       //doDbStuff1()是会回滚的
 }
 }

spring mvc-redirect

 @RequestMapping("/add")
 public String add(){
 return "channel/addindex";
 }
 @RequestMapping("/addSub")
 public String addSub(Channel channel){
 System.out.println(channel.toString());
 return "redirect:/channel/add";
 }

spring

标签:shu   any   tar   action   targe   sim   out   review   tostring   

原文地址:http://www.cnblogs.com/-10086/p/6722108.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!