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

📄 lbaddaction.java

📁 功能是公安和学校的管理系统,用struts+hibernate+spring等匡架组成,在eclepse就能编译
💻 JAVA
字号:
package com.comingnet.cgmanage;

import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.TreeMap;
import com.db.DBUtils;
import com.db.ProxoolAction;
import com.opensymphony.xwork2.ActionSupport;

public class LBaddAction extends ActionSupport {	

	private static final long serialVersionUID = -2871309932418895452L;

	private ArrayList<TreeMap<String, String>> bjnj = null;

	private ArrayList<TreeMap<String, String>> xnd = null;

	private ArrayList<TreeMap<String, String>> njlist = null;

	private int xxbh = 0;

	public String execute() {
		Connection conn = null;
		PreparedStatement stmt = null;
		ResultSet rs = null;
		try {
			String bjmc;
			conn = ProxoolAction.getConnection();
			bjnj = new ArrayList<TreeMap<String, String>>();

			String sqlstr = "select bjmc from m_class where bjby=0 and xxbh=" + xxbh;
			stmt = conn.prepareStatement(sqlstr);
			TreeMap<String, String> h = null;
			rs = stmt.executeQuery();
			while (rs.next()) {
				bjmc = rs.getString(1);
				h = new TreeMap<String, String>();
				h.put("bjmckey", bjmc);
				h.put("bjmc", bjmc);
				bjnj.add(h);
			}

		} catch (Exception e) {
			System.out.println("类别显示" + e.toString());
		} finally {
			ProxoolAction.closeResultSet(rs);
			ProxoolAction.closeStatement(stmt);

		}
		// 取得当前年份来设置类别添加年度下拉列表值
		int curryear = Calendar.getInstance().get(Calendar.YEAR);
		curryear = curryear - 1;
		
		int nextyear = curryear + 1;
		String selectvalue = "";

		xnd = new ArrayList<TreeMap<String, String>>();
		TreeMap<String, String> yeartoyear = null;
		for (int i = 0; i < 6; i++) {
			yeartoyear = new TreeMap<String, String>();
			selectvalue = curryear + "-" + nextyear;
			yeartoyear.put("yearkey", selectvalue);
			yeartoyear.put("year", selectvalue);
			xnd.add(yeartoyear);
			curryear++;
			nextyear++;
		}

		// 取得年级列表值
		try {
			int njid = 0;
			String njmc = "";

			njlist = new ArrayList<TreeMap<String, String>>();
			TreeMap<String, String> njinfo = null;
			stmt = conn
					.prepareStatement("select njid,njmc from m_nianji where mark="
							+ xxbh);
			rs = stmt.executeQuery();
			while (rs.next()) {
				njid = rs.getInt(1);
				njmc = rs.getString(2);	
				njinfo=new TreeMap<String,String>();
				njinfo.put("njid", new Integer(njid).toString());
				njinfo.put("njmc", njmc);
				njlist.add(njinfo);
			}

		} catch (Exception e) {
			System.out.println(e.toString()+"年级列表错误");
		} finally {
			ProxoolAction.closeResultSet(rs);
			ProxoolAction.closeStatement(stmt);
			ProxoolAction.closeConnection(conn);
		}
		return SUCCESS;
	}
	
	public ArrayList<TreeMap<String, String>> getBjnj() {
		return bjnj;
	}

	public void setXxbh(int xxbh) {
		this.xxbh = xxbh;
	}

	public ArrayList<TreeMap<String, String>> getXnd() {
		return xnd;
	}

	public ArrayList<TreeMap<String, String>> getNjlist() {
		return njlist;
	}
	public void setNjlist(ArrayList<TreeMap<String, String>> njlist) {
		this.njlist = njlist;
	}

	public int getXxbh() {
		return xxbh;
	}

	public void setBjnj(ArrayList<TreeMap<String, String>> bjnj) {
		this.bjnj = bjnj;
	}

	public void setXnd(ArrayList<TreeMap<String, String>> xnd) {
		this.xnd = xnd;
	}
}

⌨️ 快捷键说明

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