SSH框架搭好之后,测试Spring.xml的方法

public static void main(String[] args) {

System.out.println("开始测试");
ApplicationContext context = new FileSystemXmlApplicationContext("/WebRoot/WEB-INF/applicationContext.xml");
ContactInfoDao contactInfoDao=(ContactInfoDao)context.getBean("contactInfoDAO");

String sql="select sex as tex1,count(sex) as tex2 from contactInfo where isdelete='N' group by sex";
List list;
try {
list = contactInfoDao.getPhotos(sql);
for(int i=0;i<list.size();i++){
Object[] a = (Object[])list.get(i);

System.out.println(a[0]+":"+a[1]);
}

} catch (DaoException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}

你可能感兴趣的:(spring,sql,xml,框架,ssh)