HIBERNATE+STRUTS的问题急急急求高手

dingliang106 2010-04-19 05:29:35
用HIBERNATE和STRUTS做个管理系统。。有个非常奇怪的问题。。有遇到的朋友麻烦帮帮忙。
数据库中数据为张三,我将它修改为张三11,在页面上刷新后显示张三11,在刷新一下,又显示为张三(此时数据库中为张三11)。然后不断刷新张三和张三11交替出现。好奇怪啊。
我在页面上是查询所有数据显示出来的。我把代码贴出来。

<%@ page language="java" import="java.util.*" pageEncoding="gb2312"%>
<%@ page import="com.taxi.bean.*" %>
<%@ page import="com.taxi.dao.*" %>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<script type="text/javascript" src="/TaxiManage/alertDialog/ymPrompt.js"></script>
<link rel="stylesheet" id='skin' type="text/css" href="/TaxiManage/alertDialog/skin/qq/ymPrompt.css" />
<link rel="stylesheet" type="text/css" href="images/web.css" />
<title>无标题文档</title>

<script>
var highlightcolor='#d5f4fe';
//此处clickcolor只能用win系统颜色代码才能成功,如果用#xxxxxx的代码就不行,还没搞清楚为什么:(
var clickcolor='#51b2f6';
function changeto(){
source=event.srcElement;
if (source.tagName=="TR"||source.tagName=="TABLE")
return;
while(source.tagName!="TD")
source=source.parentElement;
source=source.parentElement;
cs = source.children;
//alert(cs.length);
if (cs[1].style.backgroundColor!=highlightcolor&&source.id!="nc"&&cs[1].style.backgroundColor!=clickcolor)
for(i=0;i<cs.length;i++){
cs[i].style.backgroundColor=highlightcolor;
}
}

function changeback(){
if (event.fromElement.contains(event.toElement)||source.contains(event.toElement)||source.id=="nc")
return
if (event.toElement!=source&&cs[1].style.backgroundColor!=clickcolor)
//source.style.backgroundColor=originalcolor
for(i=0;i<cs.length;i++){
cs[i].style.backgroundColor="";
}
}

function clickto(){
source=event.srcElement;
if (source.tagName=="TR"||source.tagName=="TABLE")
return;
while(source.tagName!="TD")
source=source.parentElement;
source=source.parentElement;
cs = source.children;
//alert(cs.length);
if (cs[1].style.backgroundColor!=clickcolor&&source.id!="nc")
for(i=0;i<cs.length;i++){
cs[i].style.backgroundColor=clickcolor;
}
else
for(i=0;i<cs.length;i++){
cs[i].style.backgroundColor="";
}
}
</script>

<%
JiashiyuanDAO bd=new JiashiyuanDAO();
List lists=(List)bd.findAll();
Jiashiyuan info=new Jiashiyuan();
%>
</head>

<body>
<table width="100%" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td height="30"><table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td height="24" bgcolor="#353c44"><table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td><table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="6%" height="19" valign="bottom"><div align="center"><img src="images/tb.gif" width="14" height="14" /></div></td>
<td width="94%" valign="bottom"><span class="STYLE1"> 驾驶员信息列表</span></td>
</tr>
</table></td>
<td></td>
</tr>
</table></td>
</tr>
</table></td>
</tr>
<tr>
<td><table width="100%" height="43" border="0" cellpadding="0" cellspacing="1" bgcolor="#a8c7ce" onmouseover="changeto()" onmouseout="changeback()">
<tr>
<td height="20" bgcolor="d3eaef" class="STYLE6"><div align="center"><span class="STYLE10">姓名

</span></div></td>
<td height="20" bgcolor="d3eaef" class="STYLE6"><div align="center"><span class="STYLE10">档案号

</span></div></td>
<td height="20" bgcolor="d3eaef" class="STYLE6"><div align="center"><span class="STYLE10">户籍

</span></div></td>
<td height="20" bgcolor="d3eaef" class="STYLE6"><div align="center"><span class="STYLE10">性别

</span></div></td>
<td height="20" bgcolor="d3eaef" class="STYLE6"><div align="center"><span class="STYLE10">家庭住址

</span></div></td>
<td height="20" bgcolor="d3eaef" class="STYLE6"><div align="center"><span class="STYLE10">联系电话
</span></div></td>
<td height="20" bgcolor="d3eaef" class="STYLE6"><div align="center"><span class="STYLE10">操作

</span></div></td>
</tr>
<%
JiashiyuanDAO jd=new JiashiyuanDAO();
QiyeDAO qd=new QiyeDAO();
int pagecount=Integer.parseInt(request.getParameter("page"));//当前页
if(pagecount<0)pagecount=0;
int infocount=20;//每页记录数
int allpage=(lists.size()+infocount-1)/infocount;//总页数
if(pagecount+1>allpage)pagecount=0;
int forcount=(pagecount+1)*infocount;
if(forcount>lists.size())forcount=lists.size();

for(int i=pagecount*infocount;i<forcount;i++)
{
info=(Jiashiyuan)lists.get(i);
%>
<tr>
<td height="20" bgcolor="#FFFFFF" class="STYLE6"><div align="center"><span class="STYLE19"><%=info.getXingming() %></span></div></td>
<td height="20" bgcolor="#FFFFFF" class="STYLE19"><div align="center"><%=info.getDanganhao() %></div></td>
<td height="20" bgcolor="#FFFFFF" class="STYLE19"><div align="center"><%=info.getHuji() %></div></td>
<td height="20" bgcolor="#FFFFFF" class="STYLE19"><div align="center"><%=info.getXingbie() %></div></td>
<td height="20" bgcolor="#FFFFFF" class="STYLE19"><div align="center"><%=info.getJiatingzhuzhi() %></div></td>
<td height="20" bgcolor="#FFFFFF" class="STYLE19"><div align="center"><%=info.getYidongdianhua() %></div></td>
<td height="20" bgcolor="#FFFFFF"><div align="center" class="STYLE21"><a href="#" onclick="isdelete('<%=info.getId() %>');">删除 </a>|<a href="detail/detailJiashiyuan.jsp?id=<%=info.getId() %>"> 查看<a></div></td>
</tr>
<%
}
%>
</table></td>
</tr>
<tr>
<td height="30"><table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="33%"><div align="left"><span class="STYLE22">    共有<strong> <%=lists.size() %></strong> 条记录,当前第<strong> <%=pagecount+1 %></strong> 页,共 <strong><%=allpage %></strong> 页</span></div></td>
<td width="67%"><table width="312" border="0" align="right" cellpadding="0" cellspacing="0">
<tr>
<td width="49"><div align="center">
<a href="showJiashiyuan.jsp?page=0"><img src="images/main_54.gif" width="40" height="15" border=0/></a>
</div></td>
<td width="49"><div align="center">
<a href="showJiashiyuan.jsp?page=<%=pagecount-1 %>"><img src="images/main_56.gif" width="45" height="15" border=0/></a>
</div></td>
<td width="49"><div align="center">
<a href="showJiashiyuan.jsp?page=<%=pagecount+1 %>"><img src="images/main_58.gif" width="45" height="15" border=0/></a>
</div></td>
<td width="49"><div align="center">
<a href="showJiashiyuan.jsp?page=<%=allpage %>"><img src="images/main_60.gif" width="40" height="15" border=0/></a>
</div></td>
<td width="37" class="STYLE22"><div align="center">转到</div></td>
<td width="22"><div align="center">
<input name="page" id="page" style="width:30px; height:17px; font-size:12px; border:solid 1px #7aaebd;" type="text"/>
</div></td>
<td width="22" class="STYLE22"><div align="center">页</div></td>
<td width="35"><img src="images/main_62.gif" width="26" height="15" onClick="go();"/></td>
</tr>
</table></td>
</tr>
</table></td>
</tr>
</table>
<script type="text/javascript">
function go()
{
var p=document.getElementById("page").value;
window.location.href="showJiashiyuan.jsp?page="+(p-1);
}
function isdelete(id)
{
ymPrompt.confirmInfo({message:"是否删除信息?!!",title:'提示',handler:function(r){if(r=='ok'){window.location.href='/TaxiManage/taxi.do?hidden=delete&type=jiashiyuan&id='+id}else{return;}}});
}
</script>
</body>


每次刷新SHOW_SQL都会有语句执行啊。我也试着在页面最后面执行了清空LISTS。清空缓存。都没用。请问这是为什么啊。有人帮帮忙么。不知道我描述清楚了没有。我QQ178739581。。希望有热心的大哥来帮忙啊。
...全文
150 6 打赏 收藏 转发到动态 举报
AI 作业
写回复
用AI写文章
6 条回复
切换为时间正序
请发表友善的回复…
发表回复
crazylaa 2010-04-22
  • 打赏
  • 举报
回复
[Quote=引用 4 楼 dingliang106 的回复:]

对。就是刷一下是张三,在刷一下是张三11.请问您有解决的办法吗。
[/Quote]
怀疑是刷一下啊就提交一次修改。
刷一下,再查一下数据库,再刷一下,再查一下数据库,看是否跟着在变。
如果是,则可能刷的时候调了action中某个方法。在action中设个断点看看。
LightningMan 2010-04-22
  • 打赏
  • 举报
回复
重部署,重启TOMCAT,然后关闭以前的浏览器,重新打开个新的,完毕!(顶楼上的,缓存问题!)
dingliang106 2010-04-22
  • 打赏
  • 举报
回复
对。就是刷一下是张三,在刷一下是张三11.请问您有解决的办法吗。
handsome_huxiulei 2010-04-19
  • 打赏
  • 举报
回复
清理一下下缓冲...
angel 2010-04-19
  • 打赏
  • 举报
回复
你说的刷新交替出现是不是刷一下是张三,再刷一下是张三11?不是的话多数是缓存问题
  • 打赏
  • 举报
回复
你把张三改成张三11后关闭浏览器,然后重新进去查询看看;我怀疑你的浏览器缓存在搞鬼

67,549

社区成员

发帖
与我相关
我的任务
社区描述
J2EE只是Java企业应用。我们需要一个跨J2SE/WEB/EJB的微容器,保护我们的业务核心组件(中间件),以延续它的生命力,而不是依赖J2SE/J2EE版本。
社区管理员
  • Java EE
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧