库里有记录,但HQL就是查不出结果。我把条件“where t.name='熊超'”去掉就可以查出结果,真不理解!
大家帮忙分析下写的是不是有问题,也没报错。
代码:
public ActionForward toUpdate(ActionMapping mapping,ActionForm form,
HttpServletRequest request,HttpServletResponse response){
List list=(List)request.getAttribute("list");
if(list==null){
list=(List)infoDao.find("from UserInfo t where t.name='熊超' order by t.name");
}
request.setAttribute("list",list); return new ActionForward("/toUpdate.jsp");
大家帮忙分析下写的是不是有问题,也没报错。
代码:
public ActionForward toUpdate(ActionMapping mapping,ActionForm form,
HttpServletRequest request,HttpServletResponse response){
List list=(List)request.getAttribute("list");
if(list==null){
list=(List)infoDao.find("from UserInfo t where t.name='熊超' order by t.name");
}
request.setAttribute("list",list); return new ActionForward("/toUpdate.jsp");
解决方案 »
- 浏览器关闭,修改登录状态问题,大神指教....
- java 可插性
- MyEclipse5.1.0GA 里面的Struts1.2是什么版本的?
- spring里用hql语句,如何取前几条记录。进来详细看一下,无论你是否能帮助小弟先谢谢了。
- 字符串替换问题
- 大家帮我看看这个struts数据添加程序!
- 是不是java,jdbc不可能向mysql数据库储存二进制文件?
- 一个关于在自己的applet类中import其他自定义包类的问题?
- classpath设置的问题,急!在线等!请高手帮帮忙!!!
- 关于java中查询数据库数据,数据量太大,拼接sql语句之后ie挂起怎么解决
- hibernate 里写sql的问题
- jsp联动搜索问题
from UserInfo t where t.name='熊超' order by t.name
order by t.name什么意思??既然查name=熊超 还要oeder by t.name??
原本是: “from UserInfo t where t.name='"+name+"' order by t.name"
那该怎么弄啊?
list=(List)infoDao.find("from UserInfo t where t.name='%熊超%' order by t.name");
然后判断是否查出
System.out.println(list.size());