topBar.jsp这个是网页顶部公用的模块.这是里面的部分代码
<div class="topBarCtrl">
<a href="user/toAdvice.shtml?pageNum=1">建议</a>|
<a href="user/toNotice.shtml?pageNum=1" class="newNotice">消息</a>|
<s:if test="#request.newsNum != null">
<a href="user/toNotice.shtml?pageNum=1">
<span class="newNum" title="新信息">您有${newsNum}条新消息!</span>
</a>
</s:if>
<a href="user/toSetPassword.shtml">帐号</a>|
<a href="user/logOut.shtml">退出</a>
</div>
当有新消息的时候点击 【你有X条新消息】,查询新消息
这里是查询的主要代码:
String hql ="from TbUser u ,TbLetter l where u.userId = l.tbUserByFkFromId.userId and l.toIsDelete=1 and l.tbUserByFkToId.userId="+tbUser.userId+" order by l.letterIsRead desc , l.letterTime desc";
//查询
List result = userDao.query(pageNo, pageSize, hql.toString());
//执行更新操作:把所有未读的letter更新为已经读
if(null != result && 0 != result.size())
{
hql =new StringBuffer(" update tb_letter set letter_is_read= 1 where letter_is_read=0 and fk_to_id =") ;
hql.append(tbUser.getUserId());
userDao.excuteSql(hql.toString());
}
return result ;
然后跳转到 notice.jsp, 但是新的消息没有查询出来。点击notice.jsp引用过来的topBar.jsp 里面的【消息】链接,这时就可以查出数据了。
2次点击的请求路径都为:user/toNotice.shtml?pageNum=1
2次执行的查询语句是一样的
如果第一次点击index.jsp的【消息】链接也不能查出数据.
请帮帮我额,这问题蛋疼几天了...先谢过了
这个连接什么意思 user代表什么
楼主点击这个时候在控制台输出一下list看看有没有值
如果没有那就是根本没调用啊
我用的是SSH2 这个连接是传到action里面, 我打了断点,进行查询操做了的,第一次把以前的消息查出来了,唯独那新的消息没查出来,在点击【消息】连接的时候,在查一遍,以前的和新的消息就都查出来了.....我确实不能理解这是为什么..