步骤八:书写数据持久层次以及业务层代码。数据持久层代码如下: public class StudentDAOImple implements IStudentDAO{ private SqlMapClientTemplate sqlMapClientTemplate; public void setSqlMapClientTemplate(SqlMapClientTemplate sqlMapClientTemplate) { this.sqlMapClientTemplate = sqlMapClientTemplate; } public List getAllStudent() {
List list = sqlMapClientTemplate.queryForList(“getAllStudent”);
return list;
}
} 以及修改修改spring的applicationContext.xml文件
步骤九:建立测试类以及测试方法。 public class Test { /** * @param args */ public static void main(String[] args) {
ApplicationContext factory = new ClassPathXmlApplicationContext(“applicationContext.xml”);
IStudentDAO dao = (IStudentDAO) factory.getBean(“studentDAO”); List list = dao.getAllStudent();