读书人

再发一帖\(quot;□)/\(quot;□)/

发布时间: 2012-02-28 13:06:34 作者: rapoo

再发一帖,\("□)/\("□)/求救

topBar.jsp这个是网页顶部公用的模块.这是里面的部分代码

CSS code
      <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条新消息】,查询新消息
这里是查询的主要代码:
Java code
     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的【消息】链接也不能查出数据.

请帮帮我额,这问题蛋疼几天了...先谢过了


[解决办法]
<a href="user/toNotice.shtml?pageNum=1">
这个连接什么意思 user代表什么
楼主点击这个时候在控制台输出一下list看看有没有值
如果没有那就是根本没调用啊
[解决办法]
你是不是那个查询只查已读的???所以你第一次点击查询已读的信息,然后把新的信息都设为已读,第二次点击查询已读的就行了?

读书人网 >J2EE开发

热点推荐