📄 configprofessiondesignaction.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.ConfigPublicCharBiz;
import org.better.hr.entity.ConfigPublicChar;
import org.better.hr.exception.HrException;
import org.better.hr.web.form.ConfigProfessionDesignForm;
public class ConfigProfessionDesignAction 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
{
ConfigProfessionDesignForm myForm = (ConfigProfessionDesignForm)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
{
ConfigProfessionDesignForm myForm = (ConfigProfessionDesignForm)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().listForProfession(null);
request.setAttribute("list", list);
return mapping.findForward("list");
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -