コード例 #1
0
ファイル: UserAction.java プロジェクト: TuWei1992/zswxsqxt
 // 岗位级别联动菜单
 public String getStates() throws Exception {
   try {
     String code = getRequest().getParameter("code");
     Dictvalue dictvalue = dictvalueManager.findByCode(code);
     List list = new ArrayList(dictvalue.getDictvalues());
     JsonConfig cfg = new JsonConfig();
     cfg.setJsonPropertyFilter(
         new PropertyFilter() {
           public boolean apply(Object source, String name, Object value) {
             if (name.equals("code") || name.equals("value")) {
               return false;
             } else {
               return true;
             }
           }
         });
     String ss = JSONArray.fromObject(list, cfg).toString();
     StringBuffer returnstr = new StringBuffer("");
     returnstr.append(ss);
     super.renderHtmlUTF(returnstr.toString());
   } catch (Exception e) {
     e.printStackTrace();
   }
   return null;
 }
コード例 #2
0
  /**
   * 策略日期列表
   *
   * @param mapping
   * @param actionForm
   * @param request
   * @param response
   * @return
   * @throws Exception
   */
  @SuppressWarnings("unchecked")
  public ActionForward tacticsDateList(
      ActionMapping mapping,
      ActionForm actionForm,
      HttpServletRequest request,
      HttpServletResponse response)
      throws Exception {
    try {
      ListQuery listQuery = new ListQuery(TacticsDate.class, request);
      List<TacticsDate> result = tacticsManager.getTacticsDateList(listQuery);
      if (result.size() > 0) {
        result = (List<TacticsDate>) result.get(1);
      }
      JsonConfig config = new JsonConfig();
      config.registerJsonValueProcessor(java.sql.Date.class, new JsonDateToStringProcessorImpl());
      config.setJsonPropertyFilter(new IgnoreFieldProcessorImpl(true, new String[] {"tactics"}));

      JSONArray dates = JSONArray.fromObject(result, config);
      print(dates.toString(), response);
    } catch (Exception e) {
      log.error(e.getMessage(), e);
    }
    return mapping.findForward("tacticsList");
  }