⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 consthelper.java

📁 采用Eclispe开发平台
💻 JAVA
字号:
package com.whatratimes.util;

import org.apache.struts.action.PlugIn;
import org.apache.struts.action.ActionServlet;
import org.apache.struts.config.ModuleConfig;
import org.apache.struts.util.LabelValueBean;

import javax.servlet.ServletException;
import javax.servlet.ServletContext;
import java.util.ArrayList;
import java.util.Random;

/**
 * Created by IntelliJ IDEA.
 * User: Tao
 * Date: May 13, 2003
 * Time: 2:32:34 PM
 */
public class ConstHelper implements PlugIn
{

    public static int NumberOfRowsInOnePage = 10;

    public static String[] ExpSelect = {
        "面向网络的编程技术",
        "面向对象的软件设计与测试",
        "软件项目管理",
        "程序设计方法学",
        "数据库基础",
        "计算机网络",
        "软件工程",
        "计算机原理",
        "操作系统",
        "编译原理",
        "离散数学",
        "数据结构"
    };
    public static String[] Certification = {
        "软件编程基础班",
        "软件系统开发技术班",
        "软件系统编程技术班",
        "软件设计和项目管理班",
        "软件编程工程师班(国际)",
        "软件系统开发工程师班(国际)"
    };

    public static String[] EnglishLevel = {
        "国家英语四级",
        "国家英语六级",
        "其他"
    };

    public static String[] MT ={"","加盟方通知","课程通知","班级通知","个人消息"};

    public static String[] PoliticalSelect = {"党员", "团员", "群众", "其它"};
    public static String[] GradeSelect = {"请选择", "精通", "熟练", "较好", "一般", "较差"};
    public static String[] CS = {"不限", "创建中", "已开通", "已关闭"};
    public static String[] UT = {"不限", "学员", "教员", "课程开发师", "教务管理员", "中心教务员"};
    public static String[] QT = {"不限", "选择题", "问答题", "实践题"};
    public static String[] ET = {"不限", "作业", "考试"};
    public static String[] ExamGoingState = {"不限", "未开始", "进行中", "已关闭"};
    public static String[] ExamStudentState = {"", "未做", "上次未完成","可再次提交", "已完成", "已批阅"};
    public static String[] InstanceStudentState = {"未做", "正在做", "已提交", "已提交", "已提交", "已批改"};


    public static String[] SubmitState = {"不限", "正在做", "未批改", "正在批改", "待下发", "已下发"};
    public static String[] SearchGradeState = {"不限", "未批改", "正在批改", "待下发", "已下发"};
    public static String[] SearchGradeQuestionState = {"不限", "未批改", "已批改"};
    public static String[] ExamStates = {"创建中", "已开放", "已关闭"};
    public static String[] GradingMode = {"按试卷", "按试题"};

    public static String[] AccountMode = {"已关闭", "正常"};
    public static String[] NewStudentMode = {"未上报", "已上报","已开帐号"};

    public static String[] SearchClassState = {"不限", "开放中", "已关闭"};
    public static String[] ClassState = {"请选择", "开放中", "已关闭"};
    public static String[] ClassCourseState = {"不限", "开放中", "已关闭"};
    public static String[] Provinces = {"安徽", "北京", "重庆", "福建", "甘肃", "广东", "广西", "贵州", "海南", "河北", "黑龙江", "河南", "湖北", "湖南", "内蒙古", "江苏", "江西", "吉林", "辽宁", "宁夏", "青海", "山西", "陕西", "山东", "上海", "四川", "天津", "西藏", "新疆", "云南", "浙江", "香港", "澳门", "台湾", "其它"};
    public static String[] SchoolState = {"已关闭", "开放中"};
    public static String[] SchoolJoinType = {"正式", "试用"};
    public static String[] SearchGender = {"男", "女"};


    public static final String DefaultPoint = "缺省知识点";

    public void destroy()
    {
    }

    public void setAttribute(ServletContext context, String name, String[] values, int start)
    {
        ArrayList al = new ArrayList();

        for (int i = start; i < values.length; i++)
        {
            al.add(new LabelValueBean(values[i], String.valueOf(i)));
        }

        context.setAttribute(name, al);
    }

    public ArrayList setAttributeValue(ServletContext context, String name, String[] values, int start)
    {
        ArrayList al = new ArrayList();

        for (int i = start; i < values.length; i++)
        {
            al.add(new LabelValueBean(values[i], values[i]));
        }

        context.setAttribute(name, al);

        return al;
    }

    public void setAttribute(ServletContext context, String name, String[] values)
    {
        setAttribute(context, name, values, 0);

    }

    public void init(ActionServlet actionServlet, ModuleConfig moduleConfig) throws ServletException
    {
        ServletContext context = actionServlet.getServletContext();

        ArrayList temp = setAttributeValue(context, "SearchProvince", Provinces, 0);
        temp.add(0, new LabelValueBean("不限", "0"));

        temp = setAttributeValue(context, "SearchGender", SearchGender, 0);
        temp.add(0, new LabelValueBean("不限", "0"));

        setAttributeValue(context, "Provinces", Provinces, 0);

        setAttribute(context, "GradingMode", GradingMode);
        setAttribute(context, "ClassState", ClassState);
        setAttribute(context, "SearchClassState", SearchClassState);

        setAttribute(context, "NewStudentMode", NewStudentMode);

        setAttribute(context, "SearchGradeQuestionState", SearchGradeQuestionState);

        setAttribute(context, "SchoolJoinType", SchoolJoinType);

        setAttribute(context, "GradeSelect", GradeSelect);

        setAttributeValue(context, "PoliticalSelect", PoliticalSelect, 0);
        setAttributeValue(context, "ExpSelect", ExpSelect, 0);
        setAttributeValue(context, "Certification", Certification, 0);
        setAttributeValue(context, "EnglishLevel", EnglishLevel, 0);

        ArrayList sgs = new ArrayList();
        sgs.add(new LabelValueBean(SearchGradeState[0], "0"));
        sgs.add(new LabelValueBean(SearchGradeState[1], "2"));
        sgs.add(new LabelValueBean(SearchGradeState[2], "3"));
        sgs.add(new LabelValueBean(SearchGradeState[3], "4"));
        sgs.add(new LabelValueBean(SearchGradeState[4], "5"));
        actionServlet.getServletContext().setAttribute("SearchGradeState", sgs);

        setAttribute(context, "ExamGoingState", ExamGoingState);


        setAttribute(context, "CourseStateSearch", CS);
        setAttribute(context, "CourseStates", CS, 1);

        setAttribute(context, "UserTypeSearch", UT);
        setAttribute(context, "UserTypes", UT, 1);

        setAttribute(context, "QuestionTypeSearch", QT);
        setAttribute(context, "QuestionTypes", QT, 1);

        setAttribute(context, "ExamTypeSearch", ET);
        setAttribute(context, "ExamTypes", ET, 1);

        ArrayList instances = new ArrayList();
        instances.add(new LabelValueBean("1", "1"));
        instances.add(new LabelValueBean("2", "2"));
        instances.add(new LabelValueBean("3", "3"));
        instances.add(new LabelValueBean("4", "4"));
        instances.add(new LabelValueBean("5", "5"));
        actionServlet.getServletContext().setAttribute("Instances", instances);


        ArrayList userstate = new ArrayList();
        userstate.add(new LabelValueBean("不限", "-1"));
        userstate.add(new LabelValueBean("已关闭", "0"));
        userstate.add(new LabelValueBean("开放中", "1"));
        actionServlet.getServletContext().setAttribute("UserStateSearch", userstate);

        ArrayList educations = new ArrayList();
        educations.add(new LabelValueBean("小学", "小学"));
        educations.add(new LabelValueBean("初中", "初中"));
        educations.add(new LabelValueBean("高中", "高中"));
        educations.add(new LabelValueBean("专科", "专科"));
        educations.add(new LabelValueBean("本科", "本科"));
        educations.add(new LabelValueBean("硕士", "硕士"));
        educations.add(new LabelValueBean("博士", "博士"));
        actionServlet.getServletContext().setAttribute("Educations", educations);

    }

    public static final Random ran = new Random(System.currentTimeMillis());

}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -