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

📄 configpubliccharaction.java

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

import java.util.HashMap;
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.ConfigPublicCharBiz;
import org.better.hr.entity.ConfigPublicChar;
import org.better.hr.exception.HrException;
import org.better.hr.web.form.ConfigPublicCharForm;


public class ConfigPublicCharAction extends BasicAction {

	private ConfigPublicCharBiz configpubliccharBiz;
	
	public ConfigPublicCharBiz getConfigpubliccharBiz() {
		return configpubliccharBiz;
	}

	public void setConfigpubliccharBiz(ConfigPublicCharBiz configpubliccharBiz) {
		this.configpubliccharBiz = configpubliccharBiz;
	}

	/**
	 * 跳转到新增页面
	 * @param mapping
	 * @param form
	 * @param request
	 * @param response
	 * @return
	 */
	public ActionForward toAdd(ActionMapping mapping, ActionForm form,
			HttpServletRequest request, HttpServletResponse response) throws HrException
	{
		return mapping.findForward("add");
	}
	
	/**
	 * 执行新增
	 * @param mapping
	 * @param form
	 * @param request
	 * @param response
	 * @return
	 */
	public ActionForward doAdd(ActionMapping mapping, ActionForm form,
			HttpServletRequest request, HttpServletResponse response) throws HrException
	{
		ConfigPublicCharForm myForm = (ConfigPublicCharForm)form;
		
		List list = this.getConfigpubliccharBiz().list(myForm.getItem());
		if(list.size() > 0)                      //存在重复属性
			return mapping.findForward("add_failure");
		else
		{
			this.getConfigpubliccharBiz().add(myForm.getItem());   //插入数据库
			return mapping.findForward("add_success");
		}
	}
	
	/**
	 * 跳转到删除页面
	 * @param mapping
	 * @param form
	 * @param request
	 * @param response
	 * @return
	 */
	public ActionForward toDelete(ActionMapping mapping, ActionForm form,
			HttpServletRequest request, HttpServletResponse response) throws HrException
	{
		ConfigPublicCharForm myForm = (ConfigPublicCharForm)form;
		
		short id = Short.parseShort(request.getParameter("id"));
		ConfigPublicChar item = this.getConfigpubliccharBiz().getbyID(id);
		
		myForm.setItem(item);
		return mapping.findForward("delete");
	}
	
	/**
	 * 执行删除
	 * @param mapping
	 * @param form
	 * @param request
	 * @param response
	 * @return
	 */
	public ActionForward doDelete(ActionMapping mapping, ActionForm form,
			HttpServletRequest request, HttpServletResponse response) throws HrException
	{
		short id = Short.parseShort(request.getParameter("id"));
		this.getConfigpubliccharBiz().delete(id);
		return mapping.findForward("del_success");
	}
	
	/**
	 * 显示数据所有列表
	 * @param mapping
	 * @param form
	 * @param request
	 * @param messages
	 * @return
	 */
	public ActionForward list(ActionMapping mapping,ActionForm form,HttpServletRequest request,HttpServletResponse response) 
								throws HrException
	{
		List list = this.getConfigpubliccharBiz().list();
		request.setAttribute("list", list);
		return mapping.findForward("list");
	}
		
}

⌨️ 快捷键说明

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