频繁操作后tomcat 页面没反应
频繁操作后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>
其它的代码均有些相似,我想知道是什么引起,或者在哪里造成死循环,求高手帮忙!