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后如果刷新,就会丢失,程序对这一过程做了考虑,从而保证系统正常运行。
阅读(787) | 评论(0) | 转发(0) |