频繁操作后tomcat 页面没反应

feimaocao 2010-11-05 04:37:13
频繁操作后tomcat 页面没反应,但日志没显示错误或关闭,出没输出任何错误,框架是用struts1.2,
部分代码如下
//action
public ActionForward comment(ActionMapping mapping,ActionForm form,
HttpServletRequest request,HttpServletResponse response){
URLform uform=(URLform)form;
Connection conn = null;
try{
conn=getDataSource(request,"sqlServer").getConnection();
commentBean cbean=new commentBean();
cbean.setConn(conn);

//记录用户的操作
actionBean action = new actionBean();
action.setConn(conn);
action.setAction("评论");
action.setUrl("");
action.setUserID((String)request.getSession().getAttribute("userid"));

if(request.getParameter("id")!=null){
uform.setUrlID(request.getParameter("id"));
return mapping.findForward("comment");
}else{
cbean.setComment(Chinese.convert(uform.getComment()));
System.out.println(Chinese.convert(uform.getComment()));
cbean.setUrlID(uform.getUrlID());
cbean.setUserID((String)request.getSession().getAttribute("userid"));

String userid=(String)request.getSession().getAttribute("userid");
if(cbean.addComment()==1){
action.inputRecord();
if(userid!=null){
response.sendRedirect("userClass.do");
}else response.sendRedirect("admin.jsp");
}else{
response.sendRedirect("fail.jsp");
}

}
}catch(SQLException e){
e.printStackTrace();
}catch(IOException e){
e.printStackTrace();
}finally
{
if (conn != null)
{
try
{
conn.close();
}
catch (SQLException e)
{
e.printStackTrace();
}
}
}
return null;
}
//bean
public int addComment(){
String sql="insert into comment(comment,userID,urlID) values('"
+comment+"','"
+userID+"','"
+urlID
+"')";
try{
Statement stmt = conn.createStatement();
int line = stmt.executeUpdate(sql);
return line;
}catch(SQLException e){
e.printStackTrace();
}
return -1;
}
struts-config.xml
<action
attribute="URLForm"
input="/comment.jsp"
name="URLForm"
path="/comment"
scope="request"
type="action.userAction"
parameter="comment">
<forward name="comment" path="/comment.jsp" />
</action>

其它的代码均有些相似,我想知道是什么引起,或者在哪里造成死循环,求高手帮忙!
...全文
168 6 打赏 收藏 转发到动态 举报
写回复
用AI写文章
6 条回复
切换为时间正序
请发表友善的回复…
发表回复
feimaocao 2010-11-05
  • 打赏
  • 举报
回复
求高手支招,到底是什么问题导致页面无反应?????
zhang1659 2010-11-05
  • 打赏
  • 举报
回复
框架不太了解呀,想学
feimaocao 2010-11-05
  • 打赏
  • 举报
回复
连接池里设连接的数如下,应该不会不够
<set-property property="minCount" value="20"/>
<set-property property="maxCount" value="50"/>
在每次使用数据库连接后,都有
finally
{
if (conn != null)
{
try
{
conn.close();
}
catch (SQLException e)
{
e.printStackTrace();
}
}
}关闭连接数据库
fkyq01 2010-11-05
  • 打赏
  • 举报
回复
是不是锁表了,或者链接池链接不够了
zn85600301 2010-11-05
  • 打赏
  • 举报
回复
是不是数据库连接 没释放掉
Jlins 2010-11-05
  • 打赏
  • 举报
回复
哎 这个难度比较大呀...不知道具体情况

81,095

社区成员

发帖
与我相关
我的任务
社区描述
Java Web 开发
社区管理员
  • Web 开发社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

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