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

📄 dicaction.java

📁 一个简单的用Spring+Hibernate+Struts的亿阳信通系统
💻 JAVA
字号:
/*
 * Generated by MyEclipse Struts
 * Template path: templates/java/JavaClass.vtl
 */
package com.chinatelecom.web.action;

import java.util.List;

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

import org.apache.commons.beanutils.BeanUtils;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;
import org.apache.struts.actions.DispatchAction;

import com.chinatelecom.mode.TDicType;
import com.chinatelecom.service.impl.DicTypeServiceImpl;

/**
 * MyEclipse Struts Creation date: 03-24-2009 字典管理模块
 * 
 * @author 王晓翠 XDoclet definition:
 * @struts.action validate="true"
 */
public class DicAction extends DispatchAction {
	/*
	 * Generated Methods
	 */

	/**
	 * Method execute
	 * 
	 * @param mapping
	 * @param form
	 * @param request
	 * @param response
	 * @return ActionForward
	 */
	DicTypeServiceImpl dictypeservice;

	public DicTypeServiceImpl getDictypeservice() {
		return dictypeservice;
	}

	public void setDictypeservice(DicTypeServiceImpl dictypeservice) {
		this.dictypeservice = dictypeservice;
	}

	/**
	 * showList方法 实现字典类型列表信息
	 * 
	 * @param mapping
	 * @param form
	 * @param request
	 * @param response
	 * @return
	 */
	public ActionForward showList(ActionMapping mapping, ActionForm form,
			HttpServletRequest request, HttpServletResponse response) {
		// TODO Auto-generated method stub
		List list = dictypeservice.findTypeList();
		request.setAttribute("typeList", list);
		return new ActionForward("DicListView");
	}

	/**
	 * addForm方法 实现新增字典类型的页面转向
	 * 
	 * @param mapping
	 * @param form
	 * @param request
	 * @param response
	 * @return
	 */
	public ActionForward addForm(ActionMapping mapping, ActionForm form,
			HttpServletRequest request, HttpServletResponse response) {
		// TODO Auto-generated method stub
		return new ActionForward("AddTypeView");
	}

	/**
	 * add方法 实现新增字典类型的功能
	 * 
	 * @param mapping
	 * @param form
	 * @param request
	 * @param response
	 * @return
	 * @throws Exception
	 */
	public ActionForward add(ActionMapping mapping, ActionForm form,
			HttpServletRequest request, HttpServletResponse response)
			throws Exception {
		// TODO Auto-generated method stub
		TDicType type = new TDicType();
		BeanUtils.copyProperties(type, form);
		dictypeservice.addType(type);
		return this.showList(mapping, form, request, response);
	}

	/**
	 * delete方法 删除字典类型的方法
	 * 
	 * @param mapping
	 * @param form
	 * @param request
	 * @param response
	 * @return
	 * @throws Exception
	 */
	public ActionForward delete(ActionMapping mapping, ActionForm form,
			HttpServletRequest request, HttpServletResponse response)
			throws Exception {
		// TODO Auto-generated method stub
		String[] ids = request.getParameterValues("check");
		dictypeservice.deleteType(ids);
		return this.showList(mapping, form, request, response);
	}

	/**
	 * updateForm方法 实现更新页面的转向
	 * 
	 * @param mapping
	 * @param form
	 * @param request
	 * @param response
	 * @return
	 * @throws Exception
	 */
	public ActionForward updateForm(ActionMapping mapping, ActionForm form,
			HttpServletRequest request, HttpServletResponse response)
			throws Exception {
		// TODO Auto-generated method stub
		long typeId = Long.parseLong(request.getParameter("typeId"));
		TDicType type = dictypeservice.findTypeById(typeId);
		request.setAttribute("type", type);
		return new ActionForward("UpdateTypeView");
	}

	/**
	 * update方法 实现字典类型的更新
	 * 
	 * @param mapping
	 * @param form
	 * @param request
	 * @param response
	 * @return
	 * @throws Exception
	 */
	public ActionForward update(ActionMapping mapping, ActionForm form,
			HttpServletRequest request, HttpServletResponse response)
			throws Exception {
		// TODO Auto-generated method stub
		TDicType type = new TDicType();
		BeanUtils.copyProperties(type, form);
		long typeId = Long.parseLong(request.getParameter("typeId"));
		type.setTypeId(typeId);
		dictypeservice.updateType(type);
		return this.showList(mapping, form, request, response);
	}
}

⌨️ 快捷键说明

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