最近已經(jīng)把ecside2.0放置到正式的開發(fā)項目中,感覺效率還可以,鑒于fins最近比較忙,一直沒有提供一個struts方面的CRUD的完整DEMO,通過上次和FINS的交流提供一個暫時解決的辦法,也發(fā)現(xiàn)ecside在處理事務方面的一個問題,不過fins說在下幾個版本中解決.
把相關的代碼帖在這里:
/**
* 修改用戶
* @param mapping
* @param form
* @param request
* @param response
* @return
* @throws Exception
*/
public ActionForward update(ActionMapping mapping, ActionForm form,
HttpServletRequest request, HttpServletResponse response)
throws Exception {
OperationTypeService service = new OperationTypeServiceImpl();// 服務操作
OperationType bean = new OperationType();
com.skywing.util.request.RequestUtil.populate(bean, request);
bean.setOid(request.getParameter(TableConstants.RECORDKEY_NAME));
bean.setCreator("創(chuàng)建者");
bean.setCreatetime(com.skywing.util.db.string.StringUtil.getToday());
try {
service.update(bean);
} catch (Exception ex) {
ex.printStackTrace();
}
String id = request.getParameter(TableConstants.RECORDKEY_NAME); //關鍵點在這里
ServletUtil.writeDefaultTextToClient(id, RequestUtil.successfulInfo(request), null, request, response);///////////////////////////////////
return null;
}
然后修改 org.ecside.util下的ServletUtil類 /** 如果沒有這個方法就添加這個方法
*
* @param recordKey 記錄的標題
* @param code //返回的代碼 // code = RequestUtil.successfulInfo(request) or RequestUtil.failedInfo(request);
* @param message //返回的信息
* @param request
* @param response
* @throws ServletException
* @throws IOException
*/
public static void writeDefaultTextToClient(String recordKey, String code,
String message, HttpServletRequest request,
HttpServletResponse response) throws ServletException, IOException {
response.setContentType("text/html");
PrintWriter out = response.getWriter();
out.flush();
out.println(code);
out.println(recordKey);
out.print(message);
out.flush();
out.close();
}
還有fins真的應該想想怎么做版本控制了,版本的變遷比較大,需要保持一定的連續(xù)性