Chinaunix首页 | 论坛 | 博客
  • 博客访问: 685753
  • 博文数量: 194
  • 博客积分: 3831
  • 博客等级: 中校
  • 技术积分: 1843
  • 用 户 组: 普通用户
  • 注册时间: 2009-02-28 13:24
文章分类

全部博文(194)

文章存档

2012年(41)

2011年(42)

2010年(45)

2009年(66)

分类: Java

2010-11-05 13:35:35

import com.fastunit.MapList;
import com.fastunit.Unit;
import com.fastunit.context.ActionContext;
import com.fastunit.jdbc.DB;
import com.fastunit.jdbc.DBFactory;
import com.fastunit.jdbc.Type;
import com.fastunit.support.UnitInterceptor;
import com.fastunit.view.unit.UnitComponent;
public class ACIntypeUI implements UnitInterceptor {
 private static final String SQL_AC_INTYPE = "select * from CCII_AC_INTYPE where intypeid = ?";
 public String intercept(ActionContext ac, Unit unit) throws Exception {
  String intype = ac.getRequestParameter("intype", "99");
  UnitComponent uc = (UnitComponent) unit;
  if (intype.equals("99")) {
   intype = (String) ac.getSessionAttribute("ac.base.intype");
  } else {
   ac.setSessionAttribute("ac.base.intype", intype);
  }
  String prefix = GetACType(intype);
  uc.setTitle(prefix + uc.getTitle());
  return unit.write(ac);
 }
 public String GetACType(String intype) {
  String intypename = "";
  try {
   DB db = DBFactory.getDB();
   MapList aclist = db.query(SQL_AC_INTYPE, new String[] { intype },
     new int[] { Type.VARCHAR });
   if (aclist.size() > 0) {
    intypename = aclist.getRow(0).get("intypename");
   } else {
    intypename = "";
   }
  } catch (Exception e) {
   // TODO: handle exception
   return "";
  }
  return intypename;
 }
}
获取到intype后如果刷新,就会丢失,程序对这一过程做了考虑,从而保证系统正常运行。
阅读(777) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~