ACTION3

本文介绍了一个Java Web应用程序中的删除功能实现细节,包括如何通过获取用户ID来确定要删除的数据,并展示了如何从数据库中删除指定记录的过程。
public ActionForward deleteApplyDetail (ActionMapping mapping, ActionForm form,
HttpServletRequest request, HttpServletResponse response)
throws Exception {

ApplyForm applyForm = (ApplyForm) form;
int elementID = applyForm.getApplyVO().getElementId();

EmployeeVO employeeVO=getEmployeeVO(request); //得到申报用户的 person_id;
int apply_employee_id=employeeVO.getEmployeeId();

int payrollID =0; // 根据申报用户的 person_id 获取payrollID

payrollID=getPayrollID(apply_employee_id);

if ((Integer) elementID != null && payrollID!=0) {

ApplicationDelegate delegate = new ApplicationDelegate();

FndFlexContextVO tempColumnVO = delegate.getApplyTemplate(elementID,payrollID);

int selectContentid=applyForm.getSelectContentId();

List templatelist = tempColumnVO.getFndFlexColumnList();

request.setAttribute("Templatelist", templatelist);

List contentList = applyForm.getApplyVO().getInstanceContentList();
//删除指定的一行,要求ID
InstanceContentVO instancecontentvo=(InstanceContentVO)contentList.get(selectContentid);

int instance_content_id=instancecontentvo.getInstance_content_id();
int instance_control_id=instancecontentvo.getInstance_control_id();


//如数据库中有数据,也要删除
if(instance_content_id!=0 && instance_control_id!=0){

ApplicationDelegate deleteDelegate = new ApplicationDelegate();
deleteDelegate.deleteApply(instancecontentvo);

}
contentList.remove(selectContentid); //从页面列表中删除
if(contentList.size()==0){
return this.changeElementAction(mapping, form, request, response);
}
}

return forwardTemplatePage(request, mapping, payrollID, elementID);

}
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值