Ejemplo n.º 1
0
  @Override
  public void init() {
    ServletContext context = getServletContext();
    WebCache webCache =
        (WebCache)
            WebApplicationContextUtils.getRequiredWebApplicationContext(context)
                .getBean("webCache");
    // 站点信息
    webCache.initSite(context);
    // 模板索引
    webCache.initTemplate(context);
    // 初始化分类树
    webCache.initCategory(context);
    // 初始化分类属性
    webCache.initCategoryAttr(context);
    // 初始化品牌
    webCache.initBrand(context);
    // 初始化价格区域
    webCache.initPriceRange(context);

    webCache.initItemIdUrlMap(context);
    // 配置初始化
    Configuration.init();
    // 其他初始化都完成后 才做Lucene的初始化
    LuceneInit luceneInit =
        (LuceneInit)
            WebApplicationContextUtils.getRequiredWebApplicationContext(context)
                .getBean("luceneInit");
    luceneInit.addIndex(context);
  }
  /**
   * Register ServletContextAwareProcessor.
   *
   * @see ServletContextAwareProcessor
   */
  @Override
  protected void postProcessBeanFactory(ConfigurableListableBeanFactory beanFactory) {
    beanFactory.addBeanPostProcessor(new ServletContextAwareProcessor(this.servletContext));
    beanFactory.ignoreDependencyInterface(ServletContextAware.class);

    WebApplicationContextUtils.registerWebApplicationScopes(beanFactory, this.servletContext);
    WebApplicationContextUtils.registerEnvironmentBeans(beanFactory, this.servletContext);
  }
	//Tree字典
	private void makeTreeDictinary(ServletContextEvent event){
		// TODO Auto-generated method stub		
		//取得appliction上下文
		ServletContext context = event.getServletContext();
		ApplicationContext ctx =WebApplicationContextUtils.getRequiredWebApplicationContext(context);
		//取得特定bean //spsxtDictionaryDao
		SpsxtDictionaryDao dao=(SpsxtDictionaryDao)ctx.getBean("spsxtDictionaryDao");
		List<TreeJson> spsxtTree=null;
		try {
			spsxtTree=dao.getQueryIndustryTree();//行业类别Tree			
			saveJSONTree2File(TreeJson.formatTree(spsxtTree),"IndustryTree");//保存到代码表文件中
			
			spsxtTree=dao.getQueryResolutionTree();//分辨率Tree			
			saveJSONTree2File(TreeJson.formatTree(spsxtTree),"ResolutionTree");//保存到代码表文件中

			spsxtTree=dao.getQuerySightTree();//是否夜视Tree			
			saveJSONTree2File(TreeJson.formatTree(spsxtTree),"SighTree");//保存到代码表文件中			
		
			spsxtTree=dao.getQueryPropertyTree();//属性Tree			
			saveJSONTree2File(TreeJson.formatTree(spsxtTree),"PropertyTree");//保存到代码表文件中
		} catch (Exception e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}

	
	}
Ejemplo n.º 4
0
  public void prepare() throws Exception {
    logger.debug("Inside PatientProfile:prepare()");
    try {
      WebApplicationContext context =
          WebApplicationContextUtils.getRequiredWebApplicationContext(
              ServletActionContext.getServletContext());
      userService = (UserService) context.getBean("userService");
      auditInfoService = (AuditInfoService) context.getBean("auditInfoService");
      patientService = (PatientService) context.getBean("patientService");
      contactService = (ContactService) context.getBean("contactService");
      logger.debug("In prepare patientService =" + patientService);
      // is client behind something?
      ipAddress = request.getHeader("X-FORWARDED-FOR");
      if (ipAddress == null) {
        ipAddress = request.getRemoteAddr();
      }
      logger.debug("client's ipAddress =" + ipAddress);
      Object obj = request.getSession().getAttribute("user");
      if (obj != null) {
        userInSession = (UserVO) obj;
      }
      logger.debug("userInSession is " + userInSession.getAttributesAsString());
      //			path = context.getServletContext().getRealPath("/");
      //			String app = context.getServletContext().getContextPath();
      //			path = path.substring(0, path.lastIndexOf(app.split("/")[1]));

    } catch (Exception e) {
      e.printStackTrace();
    }
    logger.debug("Completing PatientProfile:prepare()");
  }
  @Override
  public void configure(AtmosphereConfig config) {
    try {

      String s = config.getInitParameter(ATMOSPHERE_SPRING_EXCLUDE_CLASSES);
      if (s != null) {
        String[] list = s.split(",");
        for (String clazz : list) {
          excludedFromInjection.add(IOUtils.loadClass(getClass(), clazz));
        }

        if (list.length > 0) {
          preventSpringInjection = true;
        }
      }

      context = new AnnotationConfigApplicationContext();
      context.setParent(
          WebApplicationContextUtils.getWebApplicationContext(
              config.framework().getServletContext()));

      context.refresh();

      // Hack to make it injectable
      context.register(AtmosphereConfig.class);
      ((AtmosphereConfig)
              context.getBean(AtmosphereConfig.class.getCanonicalName(), config.framework()))
          .populate(config);
    } catch (Exception ex) {
      logger.warn("Unable to configure injection", ex);
    }
  }
Ejemplo n.º 6
0
 public void setServlet(ActionServlet actionServlet) {
   super.setServlet(actionServlet);
   ServletContext servletContext = actionServlet.getServletContext();
   WebApplicationContext wac =
       WebApplicationContextUtils.getRequiredWebApplicationContext(servletContext);
   this.petStore = (PetStoreFacade) wac.getBean("petStore");
 }
 @Override
 public void init() throws ServletException {
   ServletContext servletContext = this.getServletContext();
   WebApplicationContext webAppContext =
       WebApplicationContextUtils.getWebApplicationContext(servletContext);
   studentService = webAppContext.getBean(StudentService.class);
 }
Ejemplo n.º 8
0
 public void init(ServletConfig config) throws ServletException {
   super.init(config);
   ctx = WebApplicationContextUtils.getRequiredWebApplicationContext(config.getServletContext());
   dao = (DerbyDao) ctx.getBean("personDao");
   txManager = (PlatformTransactionManager) ctx.getBean("transactionManager");
   dao.createTable();
 }
  public void contextInitialized(ServletContextEvent se) {
    // 完成项目启动数据的初始化功能
    // 1: 如果数据量不大,更新不频繁可以存储到app缓存中, 缺点: 需要自己解决同步问题
    // 2: 数据量大,可以考虑使用hibernate二级缓存, hibernate自己提供了同步功能
    // Spring的配置文件,项目启动的时候配置文件读取后也存储到了application内置对象中
    context = WebApplicationContextUtils.getWebApplicationContext(se.getServletContext());
    categoryService = (CategoryService) context.getBean("categoryService");
    fileUploadUtil = (FileUploadUtil) context.getBean("fileUploadUtil");
    privilegeService = (PrivilegeService) context.getBean("privilegeService");
    // 获取所有的类别,并且存储到application内置中
    se.getServletContext().setAttribute("categorys", categoryService.query());
    // 通过Spring配置文件,获取线程任务
    shopTimerTask = (ShopTimerTask) context.getBean("shopTimerTask");
    shopTimerTask.setApplication(se.getServletContext());
    // 设置执行时间
    new Timer(true).schedule(shopTimerTask, 0, 1000 * 60 * 1000);

    // 通过路径获取银行图标,并且存储到application内置对象中
    String path = se.getServletContext().getRealPath("/image/logo");
    se.getServletContext().setAttribute("bankImages", fileUploadUtil.bankImage(path));

    // 获取所有权限菜单数据,支持树状结构
    se.getServletContext().setAttribute("privileges", privilegeService.getPrivilegeMenu());

    // 获取所有的purls
    se.getServletContext().setAttribute("purls", privilegeService.getPrivilegeUrl());
  }
  @Override
  public void onStartup(Set<Class<?>> c, ServletContext ctx) throws ServletException {
    logger.info("==============================");

    if (null != c) {
      for (Iterator<Class<?>> iterator = c.iterator(); iterator.hasNext(); ) {
        Class<?> clazz = (Class<?>) iterator.next();

        StudyApplicationInitializer instance = null;
        try {
          instance = (StudyApplicationInitializer) clazz.newInstance();
        } catch (Exception e) {
          e.printStackTrace();
        }

        if (null != instance) {
          instance.onStartup(ctx);
        }

        WebApplicationContext wac = WebApplicationContextUtils.getWebApplicationContext(ctx);

        logger.info(clazz);
      }
    }

    logger.info("==============================");
  }
  /**
   * Processes requests for both HTTP <code>GET</code> and <code>POST</code> methods.
   *
   * @param request servlet request
   * @param response servlet response
   * @throws ServletException if a servlet-specific error occurs
   * @throws IOException if an I/O error occurs
   */
  protected void processRequest(HttpServletRequest request, HttpServletResponse response)
      throws ServletException, IOException {
    response.setContentType("text/html;charset=UTF-8");
    PrintWriter out = response.getWriter();

    try {

      ApplicationContext appContext =
          WebApplicationContextUtils.getWebApplicationContext(this.getServletContext());
      ceaService = appContext.getBean(ICountryEnvironmentApplicationService.class);
      factoryCea = appContext.getBean(IFactoryCountryEnvironmentApplication.class);
      PolicyFactory policy = Sanitizers.FORMATTING.and(Sanitizers.LINKS);

      String id = policy.sanitize(request.getParameter("id"));
      String system = id.split("System&#61;")[1].split("&amp;")[0];
      String country = id.split("Country&#61;")[1].split("&amp;")[0];
      String env = id.split("Env&#61;")[1].split("&amp;")[0];
      String app = id.split("App&#61;")[1].split("&amp;")[0];

      response.setContentType("text/html");
      ceaService.delete(factoryCea.create(system, country, env, app, null, null, null, null));
    } catch (CerberusException ex) {
      Logger.getLogger(DeleteCountryEnvironmentParameter.class.getName())
          .log(Level.SEVERE, null, ex);
    }
  }
 @Override
 public void init() {
   if (applicationContext == null) {
     applicationContext = WebApplicationContextUtils.getWebApplicationContext(getServletContext());
   }
   computerDatabaseService = applicationContext.getBean(ComputerDatabaseService.class);
 }
Ejemplo n.º 13
0
 /**
  * Returns the messageSource bean configured in the applicationContext.xml file.
  *
  * @param request HttpServletRequest
  * @return messageSouce bean
  */
 public static MessageSource getMessageSource(HttpServletRequest request) {
   WebApplicationContext context =
       WebApplicationContextUtils.getWebApplicationContext(
           request.getSession(false).getServletContext());
   return (ResourceBundleMessageSource)
       context.getBean(ApplicationConstants.MESSAGE_SOURCE_BEAN_NAME);
 }
Ejemplo n.º 14
0
 /**
  * Get the validator resources from a ValidatorFactory defined in the web application context or
  * one of its parent contexts. The bean is resolved by type
  * (org.springframework.validation.commons.ValidatorFactory).
  *
  * @return ValidatorResources from a ValidatorFactory.
  */
 private ValidatorResources getValidatorResources() {
   // look in servlet beans definition (i.e. action-servlet.xml)
   WebApplicationContext ctx =
       (WebApplicationContext)
           pageContext
               .getRequest()
               .getAttribute(DispatcherServlet.WEB_APPLICATION_CONTEXT_ATTRIBUTE);
   ValidatorFactory factory = null;
   try {
     factory =
         (ValidatorFactory)
             BeanFactoryUtils.beanOfTypeIncludingAncestors(
                 ctx, ValidatorFactory.class, true, true);
   } catch (NoSuchBeanDefinitionException e) {
     // look in main application context (i.e. applicationContext.xml)
     ctx =
         WebApplicationContextUtils.getRequiredWebApplicationContext(
             pageContext.getServletContext());
     factory =
         (ValidatorFactory)
             BeanFactoryUtils.beanOfTypeIncludingAncestors(
                 ctx, ValidatorFactory.class, true, true);
   }
   return factory.getValidatorResources();
 }
 @Override
 public void init() throws ServletException {
   ServletContext application = this.getServletContext();
   WebApplicationContext context =
       WebApplicationContextUtils.getWebApplicationContext(application);
   this.abstractMainService = (AbstractMainService) context.getBean("abstractMainService");
 }
Ejemplo n.º 16
0
  protected void doGet(HttpServletRequest request, HttpServletResponse response)
      throws ServletException, IOException {
    log.info("HelloServlet doGet");

    ServletContext servletContext = this.getServletContext();
    WebApplicationContext wac =
        WebApplicationContextUtils.getRequiredWebApplicationContext(servletContext);
    personService = (PersonService) wac.getBean("personService");

    Person person = new Person();
    person.setFirst_name("Lee");
    person.setLast_name("Brian");

    person = personService.create(person);

    log.info("persion id created -> " + person.getEmplid());

    log.info("person -> " + personService.findByEmplid(person.getEmplid()));

    personService.delete(person);

    log.info("person deleted id -> " + person.getEmplid());

    response.setContentType("text/html");
    response.setStatus(HttpServletResponse.SC_OK);
    response.getWriter().println("<h1>Hello Servlet</h1>");
    response.getWriter().println("session=" + request.getSession(true).getId());
  }
Ejemplo n.º 17
0
  protected WebApplicationContext createWebApplicationContext(WebApplicationContext parent)
      throws BeansException {
    WebApplicationContext wac =
        WebApplicationContextUtils.getWebApplicationContext(getServletContext());
    WebApplicationContext webContext;
    // construct the SpringConfig for the container managed application
    Assert.notNull(
        parent,
        "Grails requires a parent ApplicationContext, is the /WEB-INF/applicationContext.xml file missing?");
    this.application =
        (GrailsApplication)
            parent.getBean(GrailsApplication.APPLICATION_ID, GrailsApplication.class);

    if (wac instanceof GrailsApplicationContext) {
      webContext = wac;
    } else {
      webContext = GrailsConfigUtils.configureWebApplicationContext(getServletContext(), parent);
      try {
        GrailsConfigUtils.executeGrailsBootstraps(application, webContext, getServletContext());
      } catch (Exception e) {
        GrailsUtil.deepSanitize(e);
        if (e instanceof BeansException) throw (BeansException) e;
        else {
          throw new BootstrapException("Error executing bootstraps", e);
        }
      }
    }

    initMainController(webContext);
    this.interceptors = establishInterceptors(webContext);

    return webContext;
  }
Ejemplo n.º 18
0
 public void contextInitialized(ServletContextEvent event) {
   ServletContext context = event.getServletContext();
   initUserInterface(context);
   ApplusContext.setWebApplicationContext(
       WebApplicationContextUtils.getWebApplicationContext(event.getServletContext()));
   logger.debug("\ninitialized.");
 }
  private WebApplicationContext springSetup() {
    if (logger.isDebugEnabled()) {
      String msg = String.format(" '%s'", "spring setup");
      logger.debug(msg);
    }
    StringBuilder sb = new StringBuilder();

    // in web.xml this is loaded through the contextloaderlistener
    // here since we're mocking we need to load it ourselves
    // String s = String.format("classpath:%s classpath:%s classpath:%s",
    // "spring-service-layer.xml", "spring-db-testing.xml",
    // "spring-test.xml");
    // sb.append(s);

    // TODO make this configurable
    sb.append("classpath:spring-service-layer.xml");

    // spring class in spring-test
    MockServletContext sc = new MockServletContext();

    // spring's ContextLoader.createWebApplicationContext looks for this key
    sc.addInitParameter(ContextLoader.CONFIG_LOCATION_PARAM, sb.toString());

    ServletContextListener contextListener = new ContextLoaderListener();
    ServletContextEvent event = new ServletContextEvent(sc);
    contextListener.contextInitialized(event);
    WebApplicationContext wac =
        (WebApplicationContext)
            sc.getAttribute(WebApplicationContext.ROOT_WEB_APPLICATION_CONTEXT_ATTRIBUTE);

    if (logger.isDebugEnabled()) {
      String msg = String.format("just created '%s'", wac);
      logger.debug(msg);
    }
    getSession()
        .getServletContext()
        .setAttribute(WebApplicationContext.ROOT_WEB_APPLICATION_CONTEXT_ATTRIBUTE, wac);
    getActionServlet()
        .getServletContext()
        .setAttribute(WebApplicationContext.ROOT_WEB_APPLICATION_CONTEXT_ATTRIBUTE, wac);

    // if (applicationContext == null) {
    // // this is the first time. Initialize the Spring context.
    // applicationContext = (new ContextLoader())
    // .initWebApplicationContext(getRequest().getSession()
    // .getServletContext());
    // } else {
    // // Spring context is already initialized. Set it in servlet context
    // // so that Spring's ContextLoaderPlugIn will not initialize it again
    // getRequest()
    // .getSession()
    // .getServletContext()
    // .setAttribute(
    // WebApplicationContext.ROOT_WEB_APPLICATION_CONTEXT_ATTRIBUTE,
    // applicationContext);
    // }

    return WebApplicationContextUtils.getRequiredWebApplicationContext(
        getSession().getServletContext());
  }
Ejemplo n.º 20
0
 public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain)
     throws IOException, ServletException {
   HttpSession session = ((HttpServletRequest) request).getSession(true);
   Authn authnService =
       (Authn)
           WebApplicationContextUtils.getWebApplicationContext(session.getServletContext())
               .getBean(authnBean);
   String userUid = null;
   try {
     userUid = authnService.getUserUid(request);
   } catch (Exception e) {
     if (log.isDebugEnabled()) log.debug("Could not get user uuid from authn service.");
   }
   if (log.isDebugEnabled()) log.debug("userUid=" + userUid);
   if (userUid == null) {
     if (authnRedirect != null) {
       if (authnRedirect.equals(((HttpServletRequest) request).getRequestURI())) {
         // Don't redirect to the same spot.
         chain.doFilter(request, response);
       } else {
         ((HttpServletResponse) response).sendRedirect(authnRedirect);
       }
     } else {
       ((HttpServletResponse) response).sendError(HttpServletResponse.SC_UNAUTHORIZED);
     }
   } else {
     chain.doFilter(request, response);
   }
 }
Ejemplo n.º 21
0
 public void contextInitialized(ServletContextEvent event) {
   WebApplicationContext wac =
       WebApplicationContextUtils.getRequiredWebApplicationContext(event.getServletContext());
   remoteAppCtx =
       new ClassPathXmlApplicationContext(
           new String[] {"classpath:/com/tctest/spring/spring-remoting.xml"}, wac);
 }
  @Override
  public void contextInitialized(ServletContextEvent event) {
    try {
      if (!isInit) {
        Platform.createComponentLoaderFromWebApplicationContext(
            WebApplicationContextUtils.getWebApplicationContext(event.getServletContext()));
        node = Platform.getComponentLoader().getComponent(ManagementNodeManager.class);
        bus = Platform.getComponentLoader().getComponent(CloudBus.class);
        node.startNode();
        isInit = true;
      }
    } catch (Throwable t) {
      logger.warn("failed to start management server", t);
      // have to call bus.stop() because its init has been called by spring
      if (bus != null) {
        bus.stop();
      }

      Throwable root = ExceptionDSL.getRootThrowable(t);
      new BootErrorLog().write(root.getMessage());
      if (CoreGlobalProperty.EXIT_JVM_ON_BOOT_FAILURE) {
        System.exit(1);
      } else {
        throw new CloudRuntimeException(t);
      }
    }
  }
Ejemplo n.º 23
0
  public Principal login(Object credentials, String charset) {
    List<String> decodedCredentials = Arrays.asList(decodeBase64Credentials(credentials, charset));

    HttpGraniteContext context = (HttpGraniteContext) GraniteContext.getCurrentInstance();
    HttpServletRequest httpRequest = context.getRequest();

    String user = decodedCredentials.get(0);
    String password = decodedCredentials.get(1);
    Authentication auth = new UsernamePasswordAuthenticationToken(user, password);
    Principal principal = null;

    ApplicationContext ctx =
        WebApplicationContextUtils.getWebApplicationContext(
            httpRequest.getSession().getServletContext());
    if (ctx != null) {
      AbstractAuthenticationManager authenticationManager =
          BeanFactoryUtils.beanOfTypeIncludingAncestors(ctx, AbstractAuthenticationManager.class);
      try {
        Authentication authentication = authenticationManager.authenticate(auth);
        SecurityContext securityContext = SecurityContextHolder.getContext();
        securityContext.setAuthentication(authentication);
        principal = authentication;
        SecurityContextHolder.setContext(securityContext);
        saveSecurityContextInSession(securityContext, 0);

        endLogin(credentials, charset);
      } catch (AuthenticationException e) {
        handleAuthenticationExceptions(e);
      }
    }

    log.debug("User %s logged in", user);

    return principal;
  }
Ejemplo n.º 24
0
 @Override
 public void init(FilterConfig filterConfig) throws ServletException {
   WebApplicationContext webApplicationContext =
       WebApplicationContextUtils.getRequiredWebApplicationContext(
           filterConfig.getServletContext());
   menuCache = (MenuCache) webApplicationContext.getBean("menuCache");
 }
Ejemplo n.º 25
0
 @Override
 public void init(ServletConfig config) throws ServletException {
   super.init(config);
   WebApplicationContext context =
       WebApplicationContextUtils.getRequiredWebApplicationContext(config.getServletContext());
   jookService = (JookService) context.getBean(Jook.SPRING_BEAN_NAME_JOOK_SERVICE);
 }
Ejemplo n.º 26
0
 /**
  * Initialization of the servlet. <br>
  *
  * @throws ServletException if an error occurs
  */
 public void init(ServletConfig config) throws ServletException {
   // Put your code here
   ServletContext servletContext = config.getServletContext();
   this.wac = WebApplicationContextUtils.getRequiredWebApplicationContext(servletContext);
   this.investmentPlanService = (InvestmentPlanService) this.wac.getBean("investmentPlanService");
   this.fundMonthPlanService = (FundMonthPlanService) this.wac.getBean("fundMonthPlanService");
 }
Ejemplo n.º 27
0
  @Override
  public void init(ServletConfig config) throws ServletException {

    ctx = WebApplicationContextUtils.getRequiredWebApplicationContext(config.getServletContext());

    db = ctx.getBean("DataBroker", DataBroker.class);
  }
Ejemplo n.º 28
0
  protected void doGet(HttpServletRequest request, HttpServletResponse response)
      throws ServletException, IOException {

    WebApplicationContext ctx =
        WebApplicationContextUtils.getRequiredWebApplicationContext(this.getServletContext());
    CourseManager manager = (CourseManager) ctx.getBean("courseManager");

    InternetAddress addr;
    InternetAddress address[] = new InternetAddress[1];
    addr = new InternetAddress("*****@*****.**", "cust", "BIG5");
    address[0] = addr;

    manager.sendMail(
        "",
        "",
        "www.cust.edu.tw",
        "*****@*****.**",
        "王小明",
        new Date(),
        "測試",
        "<img src='http://192.192.237.19/CIS/CountImage?userid=77'>",
        address,
        null);

    // response.setContentType("image/jpeg");
    // response.sendRedirect("/CIS/pages/images/transparent.gif");
  }
Ejemplo n.º 29
0
  @Override
  public String execute() throws Exception {

    ActionContext ctx = ActionContext.getContext();

    ServletContext sc = (ServletContext) ctx.get(ServletActionContext.SERVLET_CONTEXT);

    ApplicationContext appContext = WebApplicationContextUtils.getRequiredWebApplicationContext(sc);

    CourseManagerImpl cmi = (CourseManagerImpl) appContext.getBean("CourseManagerImpl");
    StudentManagerImpl smi = (StudentManagerImpl) appContext.getBean("StuManagerImpl");

    List cmiList = cmi.getCourses();
    List smiList = smi.getStudents();

    Map cmiMap = new HashMap();
    Map smiMap = new HashMap();

    for (int i = 0; i < cmiList.size(); i++) {
      Course course = (Course) cmiList.get(i);
      cmiMap.put(course.getCoursId(), course.getCoursName());
    }

    for (int i = 0; i < smiList.size(); i++) {
      Student student = (Student) smiList.get(i);
      smiMap.put(student.getStuId(), student.getStuName());
    }

    ActionContext actionContext = ActionContext.getContext();
    Map session = actionContext.getSession();
    session.put("cmiMap", cmiMap);
    session.put("smiMap", smiMap);
    return SUCCESS;
  }
	//普通字典
	private void makeGeneralDictinary(ServletContextEvent event){
		// TODO Auto-generated method stub
		//取得appliction上下文
		ServletContext context = event.getServletContext();
		ApplicationContext ctx =WebApplicationContextUtils.getRequiredWebApplicationContext(context);
		//取得特定bean //spsxtDictionaryDao
		SpsxtDictionaryDao dao=(SpsxtDictionaryDao)ctx.getBean("spsxtDictionaryDao");
		try {
			List<Map<String,String>> list =(List<Map<String,String>>)dao.querySpsxtDictionary();	
			String prevDmlb="";
			List dmList=new ArrayList();
			
			for(Map<String,String> theMap :list){
				String currentDmlb=theMap.get("dmlb");
				if(!currentDmlb.equals(prevDmlb)){//新的代码开始
					//将dmList中的内容转换为JSON格式,然后写入到文件中,同时再次实例化dmList,为处理下一个代码表做准备
					if(!prevDmlb.equals("")){//排除首次					   
						saveJSON2File(dmList,prevDmlb);
					}
					prevDmlb=currentDmlb;//保存这个新的代码类别
					dmList=new ArrayList();
				}//end if(dmlb.equals(prevDmlb)
				dmList.add(new SpsxtDictionaryVO(theMap.get("dm"),theMap.get("dmyy"),theMap.get("pym")));
				
			}//end for
			//保存最后一个代码表
			saveJSON2File(dmList,prevDmlb);
		
		} catch (Exception e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}

	
	}