예제 #1
0
 /**
  * @param request
  * @return
  * @throws FragmentEventException
  */
 public HtmlFragmentResponse showEdit(HtmlFragmentRequest request) throws FragmentEventException {
   HtmlFragmentResponse res = getResponse();
   try {
     FinancialBean bean = (FinancialBean) request.getForm("financial");
     if (bean.getFinancial() == null) {
       MessageWidget message = new DefaultMessageWidget("请选择一条记录");
       message.fail();
       res.addMessage(message);
       return res;
     }
     Company financial = finService.getFinancialByID(bean.getFinancial().getId());
     if (financial != null) {
       bean.setFinancial(financial);
       FormWidget form = new DefaultFormWidget("financial", bean);
       res.addForm(form);
     } else {
       FormWidget form = new DefaultFormWidget("financial", new FinancialBean());
       res.addForm(form);
     }
   } catch (Exception e) {
     log.error(e.getMessage(), e);
     throw new FragmentEventException(e);
   }
   res.forward("pages/financial/editFinancial.html");
   return res;
 }