1、我写了一个登录页
登录密码:
2、从数据库中查出admin的全部数据放到List集合中
public List get()
{
Configuration cfg=new Configuration().configure();
ServiceRegistry sr=new StandardServiceRegistryBuilder().applySettings(cfg.getProperties()).build();
SessionFactory sf=cfg.buildSessionFactory(sr);
Session se=sf.openSession();
Transaction tra=se.beginTransaction();
//查询数据
String Hql="from Admin_1";
List<Admin_1> rtn=se.createQuery(Hql).list();
//提交事务
tra.commit();
//释放资源
se.close();
sf.close();
return rtn;
}
3、怎么在sever层写个方法验证一下呢?