数据页面传递问题,菜鸟的提问!
我用hibernate+struts的,我在action页面用了查询,然后想把查询结果放到Action跳转后的页面能使用,我该怎么做。下面是我的代码:action 页面代码:public ActionForward execute(ActionMapping mapping, ActionForm form,
HttpServletRequest request, HttpServletResponse response) {
String FD="ok";
List Li = null;
Stu stu=new Stu();
WelcomeForm welcomeForm = (WelcomeForm) form;// TODO Auto-generated method stub
Session session = HibernateSessionFactory.getSession();
String hql = "from Stu t where t.name='"+welcomeForm.getName()+"' and t.password='"+welcomeForm.getPassword()+"'";
Query query=session.createQuery(hql);
Li = query.list();
HttpSession sess2=request.getSession();
sess2.setAttribute("Li", Li);
return mapping.findForward(FD);
}
跳转后jsp页面使用代码:
<%List Li= (List)request.getParameter("Li"); %>(报错说String不能往List转)