为什么从servlet跳转不到jsp页面
privatevoidshowAllUser(HttpServletRequestrequest,HttpServletResponseresponse){//TODOA...
private void showAllUser(HttpServletRequest request, HttpServletResponse response) {
// TODO Auto-generated method stub
UserDao userdao = new UserDaoImpl();
List<User> list = userdao.findallUser();
//getAttribute()方法查询list的各种属性的值
request.setAttribute("list", list);
//getParameter()取页面的参数,页面的表单参数通过request传过来,通过这个方法取出来
//String resource = request.getParameter("resource");
String url = "kankan.jsp";
try {
request.getRequestDispatcher(url).forward(request, response);
} catch (ServletException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
} 展开
// TODO Auto-generated method stub
UserDao userdao = new UserDaoImpl();
List<User> list = userdao.findallUser();
//getAttribute()方法查询list的各种属性的值
request.setAttribute("list", list);
//getParameter()取页面的参数,页面的表单参数通过request传过来,通过这个方法取出来
//String resource = request.getParameter("resource");
String url = "kankan.jsp";
try {
request.getRequestDispatcher(url).forward(request, response);
} catch (ServletException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
} 展开
1个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询