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

📄 configprimarykeyaction.java

📁 hr伯乐管理系统!非常适合java学员做学习参考用!是用集成框架开发的Struts+hrbernet+Spring 开发的
💻 JAVA
字号:
package org.better.hr.web.action;

import java.util.List;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;
import org.better.hr.biz.ConfigPrimaryKeyBiz;
import org.better.hr.entity.ConfigPrimaryKey;
import org.better.hr.exception.HrException;
import org.better.hr.web.form.ConfigPrimaryKeyForm;

public class ConfigPrimaryKeyAction extends BasicAction {
	
	private ConfigPrimaryKeyBiz configprimarykeyBiz;  //业务操作对象

	public ConfigPrimaryKeyBiz getConfigprimarykeyBiz() {
		return configprimarykeyBiz;
	}

	public void setConfigprimarykeyBiz(ConfigPrimaryKeyBiz configprimarykeyBiz) {
		this.configprimarykeyBiz = configprimarykeyBiz;
	}

	/**
	 * 跳转到新增页面
	 * @param mapping
	 * @param form
	 * @param request
	 * @param response
	 * @return
	 */
	public ActionForward doRegister(ActionMapping mapping, ActionForm form,
			HttpServletRequest request, HttpServletResponse response) throws HrException
	{
		ConfigPrimaryKeyForm myForm = (ConfigPrimaryKeyForm)form;
		ConfigPrimaryKey item = myForm.getItem();
		String table = item.getPrimaryKeyTable();
		List list = myForm.getList();
		for(int i=0;i<list.size();i++)
		{
			ConfigPrimaryKey key = (ConfigPrimaryKey)list.get(i);
			key.setPrimaryKeyTable(table);
			key.setPrimaryKeyStatus(key.isChecked()?(byte)1:(byte)0);
			this.getConfigprimarykeyBiz().update(key);
		}
		return mapping.findForward("register_success");
	}
	
	/**
	 * 显示数据所有列表
	 * @param mapping
	 * @param form
	 * @param request
	 * @param messages
	 * @return
	 */
	public ActionForward list(ActionMapping mapping,ActionForm form,HttpServletRequest request,HttpServletResponse response) 
								throws HrException
	{
		ConfigPrimaryKeyForm myForm = (ConfigPrimaryKeyForm)form;
		ConfigPrimaryKey item = myForm.getItem();
		List list = this.getConfigprimarykeyBiz().list(item);
		for(int i=0;i<list.size();i++)
		{
			ConfigPrimaryKey key = (ConfigPrimaryKey)list.get(i);
			key.setChecked(key.getPrimaryKeyStatus() == 1?true:false);
		}
		request.setAttribute("list", list);
		return mapping.findForward("register");
	}
	
	/**
	 * 跳转到输入查询条件的页面
	 * @param mapping
	 * @param form
	 * @param request
	 * @param response
	 * @return
	 * @throws HrException
	 */
	public ActionForward locate(ActionMapping mapping,ActionForm form,HttpServletRequest request,HttpServletResponse response) 
	throws HrException
	{
		return mapping.findForward("locate");
	}
		
}

⌨️ 快捷键说明

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