1.建议通过service层访问,不要直接调用Dao2.可以这样来访问:WebApplicationContext springCtx = WebApplicationContextUtils.getWebApplicationContext(servletContext);
Service service = (Service)springCtx.getBean("Service");//如果你一定要直接访问Dao的话
Dao dao = (Dao)springCtx.getBean("Dao");

解决方案 »

  1.   

    按照我上面的方法,还有个问题就是怎么在你的DSelect类中获得servletContext
    因为对自定义标签不熟,不知道怎么弄,要你自己想办法了,呵呵
      

  2.   

    DSelect
    中可以得到Context不?可以的话那基本上就没问题了啊
      

  3.   

    标签中肯定能得到Context这样行不 pageContext.getServletContext()
      

  4.   

    根据楼上的朋友的建议试验成功
    如下:
         @SuppressWarnings("unused")
    ServletContext servletContext = pageContext.getServletContext();
        
         WebApplicationContext springCtx = WebApplicationContextUtils.getWebApplicationContext(servletContext);
         DictionarySelectTagDAO dictDAO = (DictionarySelectTagDAO)springCtx.getBean("dictDAO");     List dlist = dictDAO.selectDictionaryList("Dict.select-all-user");能正确地取出数据。
    为什么不用Service?
    因为在控件里并不需要事务处理,仅仅是简单的查询一个数据列表,并且是包装在一个标签类中,
    基本不用采用业务处理中的顺序调用逻辑,为了简单起见,直接调用了DAO,呵呵。