if ("list".equals(thisForm.getActiontype())) {
} else if (thisForm.getActiontype() != null) {
actiontype = thisForm.getActiontype();
FactoryDTO fact=new FactoryDTO();
if(thisForm.getFactoryid()!=null)
fact = factoryManager.findByID(thisForm.getFactoryid());
if (thisForm.isSubmits()) {
tranFormToDTO(fact, thisForm);
if (fact.getChfactoryid() == null
&& !thisForm.getActiontype().equals("del")) {
if (!newFactory(factoryList, fact, request))
return mapping.findForward(actiontype);
factoryList = factoryManager.findAll(pageModel);
request.setAttribute("factList", factoryList);
} else {
if (thisForm.getActiontype().equals("del")) {
if (fact.getChfactoryid() == null) {
return mapping.findForward("edit");
}
try {
deleteFactory(fact);
} catch (Exception e) {
actionerrors.add("error", new ActionError(
"del.error", "该厂家已有相关数据!"));
saveErrors(request, actionerrors);
return mapping.findForward("edit");
}
} else {
if (!modifyFactory(factoryList, fact, request))
return mapping.findForward(actiontype);
}
}
return mapping.findForward("listDo");
} else {
tranDTOToForm(fact, thisForm);
}
} else if (thisForm.getActiontype() != null) {
actiontype = thisForm.getActiontype();
FactoryDTO fact=new FactoryDTO();
if(thisForm.getFactoryid()!=null)
fact = factoryManager.findByID(thisForm.getFactoryid());
if (thisForm.isSubmits()) {
tranFormToDTO(fact, thisForm);
if (fact.getChfactoryid() == null
&& !thisForm.getActiontype().equals("del")) {
if (!newFactory(factoryList, fact, request))
return mapping.findForward(actiontype);
factoryList = factoryManager.findAll(pageModel);
request.setAttribute("factList", factoryList);
} else {
if (thisForm.getActiontype().equals("del")) {
if (fact.getChfactoryid() == null) {
return mapping.findForward("edit");
}
try {
deleteFactory(fact);
} catch (Exception e) {
actionerrors.add("error", new ActionError(
"del.error", "该厂家已有相关数据!"));
saveErrors(request, actionerrors);
return mapping.findForward("edit");
}
} else {
if (!modifyFactory(factoryList, fact, request))
return mapping.findForward(actiontype);
}
}
return mapping.findForward("listDo");
} else {
tranDTOToForm(fact, thisForm);
}
另外主要是代码没任何注释,这点比老多的if else还要差劲。