public String search() throws UnsupportedEncodingException
{
Session session=HibernateSessionFactory.getSession();
Transaction transaction=session.beginTransaction();
String sql="from Goods where Name like '%"+Name+"%'";
System.out.println(sql);
Query query=session.createQuery(sql);
List goodList=query.list();
System.out.println(goodList.size());
transaction.commit();
HibernateSessionFactory.closeSession();
Map request=(Map)ActionContext.getContext().get("request");
request.put("goodList", goodList);
return ActionSupport.SUCCESS;
}
上面的不知道应该在result。jsp里面显示出查询结果。。求路过的大大们指导下
------解决方案--------------------------------------------------------
不用从request中取,只要类中有getGoodList方法就行,通过struts2的标签直接用goodList就能得到结果
------解决方案--------------------------------------------------------