
已解决问题
谷歌alrqyx4用户在2016.01.07提交了关于“峨眉山怎么用hibernate在jsp页面显示**库**”的提问,欢迎大家涌跃发表自己的观点。目前共有1个回答,最后更新于2024-10-31T17:51:24。希望大家能够帮助她。详细问题描述及疑问:期待您的答案,感谢你,我会记得你对我的好的 !
详细问题描述及疑问:期待您的答案,感谢你,我会记得你对我的好的 !
jsp页面显示
在用hibernate中通过queryAllEmp()获取**库中员工信息:
publicList<Emp>queryAllEmp();//查询全
在接口实现类EmpDa
p
List<Emp>li
tr.commit(
r
}
页面跳转到Sh
packagecom.cn.service;
publicvoiddoGet(
throwsSe
response.se
this.doPost
out
out.close();
}
publicvoiddoPost(h**ttpServletRequestrequest,h**ttpServletResponseresponse)
throwsServletException,IOException{
response.setContentType("text/html");
PrintWriterout=response.getWriter();
List<Emp>list=newArrayList<Emp>();
EmpDaodao=newEmpDaoImp();
list=dao.queryAllEmp();//调用实现类的查询全部方法
request.setAttribute("list",list);//把查询结果放入request对象中
request.getRequestDispatcher("showAllEmp.jsp").forward(request,response);//转发到现实全部的页面
out.flush();
out.close();
}
}