开发中往往需要定义一些常量。单个的很简单,如果是多个一组的话,
1.使用枚举定义
public enum SV_QUESTION_TYPE {/**选择题*/choice(0),/**填空题*/fill(1);private final Integer type;private SV_QUESTION_TYPE(Integer type) {this.type = type;}public Integer getValue(){return type;}}
2.使用静态常量map定义 (推荐) ,在页面存入的时候比较方便
/*** 收集数据列类型*/public final static Map<String, Integer> gatherDataColumnStatus = new HashMap<String, Integer>();static{examStatistMap.put(CONST_ZERO, "九型人格型");examStatistMap.put(CONST_ONE, "感知与偏好型");gatherDataColumnStatus.put("COMMON_COLUMN", 0); //普通列gatherDataColumnStatus.put("EMPCODE_COLUMN", 1); //工号列gatherDataColumnStatus.put("GATHER_COLUMN", 2); //收集列}/** CHR组织架构维护-DRP系统-部门所属主体默认值*/public static String SYNCDEPTINFO_DRPENTITY_DEFAULT;
该方法定义好之后。如果view页面需要用到,则存入范围之内