不知道你说的是什么意思,刷新只是重新载入页面,调用一下某个方法,既然第一次可以,那么其他的次数应该也不会出问题的,可能是你web服务器负载太大了,速度比较慢!

解决方案 »

  1.   

    极有可能是hibernate未正确释放连接
      

  2.   

    可能是你web服务器负载太大了,速度比较慢,怎么可能,才两次就挂了,哪有这样的服务器,256内存的赛扬2.0都不会出这个效果。可以肯这是程序有问题,可能原因。数据库连接未释放,导致死锁。一个永无执行不完的线程同步方法。仔细查一下吧。
      

  3.   

    我的JSP页面:<%@ page contentType="text/html;charset=gbk"%>
    <%@ page import="java.util.*"%>
    <%@ taglib uri="http://struts.apache.org/tags-bean" prefix="bean" %>
    <%@ taglib uri="http://struts.apache.org/tags-html" prefix="html" %>
    <%@ taglib uri="http://struts.apache.org/tags-logic" prefix="logic" %>
    <%@ taglib uri="http://struts.apache.org/tags-tiles" prefix="tiles" %>
    <html:html lang="true">
    <head>


    <script type="text/javascript" src="js/xingxing.js"></script>

    <LINK href="/MY_ZNT/css/Style_Login.css" type=text/css rel=stylesheet>
    </head>
    <body>
    <center>
    <jsp:include flush="true" page="inc/template.jsp"/>
    </center><logic:notEmpty name="users" scope="session">
    <logic:notEmpty name="times" scope="request">
    <p align="center">
    <marquee><font color="Lime">√,注册成功!&nbsp&nbsp</font>
    <font color="Teal">欢迎新用户&nbsp&nbsp</font><font color="red">${users }</font>
    <font color="Teal">,&nbsp&nbsp&nbsp&nbsp注册时间为→&nbsp</font><font color="red">${times }</font>
    </marquee>
    </p>
    </logic:notEmpty>
    <logic:notEmpty name="times1" scope="request">
    <p align="center">
    <font color="Lime">√,登录成功!&nbsp&nbsp</font>
    <font color="Teal">欢迎用户&nbsp&nbsp</font><font color="red">${users }</font>
    <font color="Teal">回来,&nbsp&nbsp&nbsp&nbsp本次登录时间为→</font><font color="red">${times }</font>
    </p>
    </logic:notEmpty>
    </logic:notEmpty>
    <logic:empty name="users" scope="session">
    <div align="center">
    <font color="Teal">游客,你好!欢迎光临~&nbsp&nbsp</font><font color="red">${users }</font>
    <font color="Teal">&nbsp&nbsp&nbsp&nbsp本次登录时间为→</font><font color="red"><%=new java.text.SimpleDateFormat("yyyy年MM月dd日-HH:mm:ss").format(new Date()) %></font>
    <br><h5 align="center"><a href="show.do"  class="font_12_999"><div id="menu-bg1" style="width: 80px" >进入首页?</div></a></h5>

    </div>
    </logic:empty><table border="1" width="100%">
    <tr>
    <td rowspan="4">
    <logic:present name="list" scope="request">
    <logic:iterate id="item" name="list" scope="request">
    <h3><a href="show.do?itemid=${item.itemid}&status=selectitem" >${item.itemname}</a></h3>
    <logic:iterate id="sub" name="item" property="subitems">
    <h4>&nbsp;&nbsp;<a
    href="show.do?itemid=${item.itemid}&subid=${sub.subid}&status=selectsub">${sub.subname}</a></h4>
    </logic:iterate>
    </logic:iterate>
    </logic:present>
    </td>
    <td>
    <TABLE width="204" border="0" cellspacing="0" cellpadding="0" align="center">
      <TR>
        <TD id="menu-bg1" style="border:1 #ff7000 solid;border-bottom:0;">·待解决的问题~</TD>
      </TR>
      <TR>
        <TD style="padding-left:10px;border:1 #ff7000 solid;border-top:0;">
        <MARQUEE height="140" direction="up" onMouseOver="this.stop()" 
        onMouseOut="this.start()" scrollamount="1">       
          <logic:present name="strutsNo" scope="request">
           <logic:iterate id="item" name="strutsNo" scope="request">
          <a href="#"  class="font_12_999">· ${item.title }</a><br>→
          
           <bean:write name="item" property="questiontime" format="MM/dd/hh:mm"/>              
           <br>
           </logic:iterate>
          </logic:present>
         </MARQUEE>
         </TD>
      </TR>
    </TABLE>
    <br>
    <TABLE width="204" border="0" cellspacing="0" cellpadding="0" align="center">
      <TR>
        <TD id="menu-bg1"style="border:1 #ff7000 solid;border-bottom:0;">·已解决的问题~</TD>
      </TR>
      <TR>
        <TD style="padding-left:10px;border:1 #ff7000 solid;border-top:0;">
          <MARQUEE height="140" direction="up" onMouseOver="this.stop()" onMouseOut="this.start()" scrollamount="1">
          
          <logic:present name="strutsYes" scope="request">
           <logic:iterate id="item" name="strutsYes" scope="request">
           <a href="#"  class="font_12_999">· ${item.title }</a><br>→
           <bean:write name="item" property="questiontime" format="MM/dd/hh:mm"/><BR>
         
           </logic:iterate>
          </logic:present>
         </MARQUEE>
        </TD>
      </TR>
    </TABLE>
    <br>
    <TABLE width="204" border="0" cellspacing="0" cellpadding="0" align="center">
      <TR>
        <TD id="menu-bg1"style="border:1 #ff7000 solid;border-bottom:0;">·最新发表的问题</TD>
      </TR>
      <TR>
        <TD style="padding-left:10px;border:1 #ff7000 solid;border-top:0;">
         <MARQUEE height="140" direction="up" onMouseOver="this.stop()" onMouseOut="this.start()" scrollamount="1">
          
          <logic:present name="questiontime" scope="request">
           <logic:iterate id="item" name="questiontime" scope="request">
           <a href="#"  class="font_12_999">· ${item.title }</a><br>→
           <bean:write name="item" property="questiontime" format="MM/dd/hh:mm"/><BR>
          
           </logic:iterate>
          
          
          </logic:present>
         </MARQUEE>
        </TD>
      </TR>
    </TABLE>
    </td>
    <td>
    <TABLE width="204" border="0" cellspacing="0" cellpadding="0" align="center">
      <TR>
        <TD id="menu-bg1"style="border:1 #ff7000 solid;border-bottom:0;">·推荐的问题~</TD>
      </TR>
      <TR>
        <TD style="padding-left:10px;border:1 #ff7000 solid;border-top:0;">
         <MARQUEE height="140" direction="up" onMouseOver="this.stop()" onMouseOut="this.start()" scrollamount="1">
          
          <logic:present name="commenflag" scope="request">
           <logic:iterate id="item" name="commenflag" scope="request">
           <a href="#"  class="font_12_999">· ${item.title }</a><br>→
           <bean:write name="item" property="questiontime" format="MM/dd/hh:mm"/><BR>
      
           </logic:iterate>
          </logic:present>
         </MARQUEE>
        </TD>
      </TR>
    </TABLE>
    <br>
    <TABLE width="204" border="0" cellspacing="0" cellpadding="0" align="center">
      <TR>
        <TD id="menu-bg1"style="border:1 #ff7000 solid;border-bottom:0;">·点击排行榜~</TD>
      </TR>
      <TR>
        <TD style="padding-left:10px;border:1 #ff7000 solid;border-top:0;">
         <MARQUEE height="140" direction="up" onMouseOver="this.stop()" onMouseOut="this.start()" scrollamount="1">
          
          <logic:present name="clickcount" scope="request">
           <logic:iterate id="item" name="clickcount" scope="request">
           <a href="#"  class="font_12_999">· ${item.title }</a><br>→${item.clickcount }次<BR>
          
           </logic:iterate>
          </logic:present>
         </MARQUEE>
        </TD>
      </TR>
    </TABLE>
    <br>
    <TABLE width="204" border="0" cellspacing="0" cellpadding="0" align="center">
      <TR>
        <TD id="menu-bg1"style="border:1 #ff7000 solid;border-bottom:0;">·人气排行榜~</TD>
      </TR>
       </TABLE>
    </td>
    </tr>
    </table><br><br><br><br><br>
    <center>
    <jsp:include flush="true" page="/inc/1.htm" />
    </center>
    </body>
    </html:html>
      

  4.   

    ------------------------------------------------------------
    我的Action:package cn.liang.struts;import java.util.List;import javax.servlet.http.HttpServletRequest;
    import javax.servlet.http.HttpServletResponse;import org.apache.struts.action.Action;
    import org.apache.struts.action.ActionForm;
    import org.apache.struts.action.ActionForward;
    import org.apache.struts.action.ActionMapping;
    import org.springframework.context.support.ClassPathXmlApplicationContext;import cn.liang.pojo.Item;
    import cn.liang.pojo.Question;
    import cn.liang.pojo.Users;
    import cn.liang.service.TempBizImpl;public class IndexAction extends Action
    {
    private TempBizImpl tempBizImpl; public void setTempBizImpl(TempBizImpl tempBizImpl)
    {
    this.tempBizImpl = tempBizImpl;
    } public ActionForward execute(ActionMapping mapping, ActionForm form,
    HttpServletRequest request, HttpServletResponse response)
    {
    ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext(
    "applicationContext_*.xml");
    Users user = (Users) context.getBean("users");
    Item item = (Item) context.getBean("item");
    Question qestion = (Question) context.getBean("qestion"); String path = "err"; List list = tempBizImpl.selectAll(item.getClass());
    List strutsYes = tempBizImpl.selectByQuestion("status", 2);
    List strutsNo = tempBizImpl.selectByQuestion("status", 1);
    List commenflag = tempBizImpl.selectByQuestion("commenflag", 1); List questiontime = tempBizImpl.selectOrderBy(qestion.getClass(),
    "questiontime");
    List clickcount = tempBizImpl.selectOrderBy(qestion.getClass(),
    "clickcount"); request.setAttribute("list", list);
    request.setAttribute("strutsYes", strutsYes);
    request.setAttribute("strutsNo", strutsNo);
    request.setAttribute("commenflag", commenflag);
    request.setAttribute("questiontime", questiontime);
    request.setAttribute("clickcount", clickcount); path = "show"; return mapping.findForward(path);
    }
    }
    ------------------------------------------------------
    我的applicationContext.xml
    <?xml version="1.0" encoding="UTF-8"?>
    <beans
    xmlns="http://www.springframework.org/schema/beans"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd">
    <bean id="dataSource"
    class="org.apache.commons.dbcp.BasicDataSource">
    <property name="driverClassName">
    <value>com.microsoft.jdbc.sqlserver.SQLServerDriver</value>
    </property>
    <property name="url">
    <value>jdbc:microsoft:sqlserver://localhost:1433;databasename=ZNT</value>
    </property>
    <property name="username">
    <value>sa</value>
    </property>
    <property name="password">
    <value></value>
    </property>
    </bean>

    <bean id="sessionFactory"
    class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">
    <property name="dataSource">
    <ref bean="dataSource"></ref>
    </property>
    <property name="mappingResources">
    <list>
    <value>
    cn/liang/pojo/Admin.hbm.xml
    </value>
    <value>
    cn/liang/pojo/Answer.hbm.xml
    </value>
    <value>
    cn/liang/pojo/Item.hbm.xml
    </value>
    <value>
    cn/liang/pojo/Question.hbm.xml
    </value>
    <value>
    cn/liang/pojo/Subitem.hbm.xml
    </value>
    <value>
    cn/liang/pojo/Users.hbm.xml
    </value>
    </list>
    </property>
    <property name="hibernateProperties">
    <props>
    <prop key="hibernate.dialect">
    org.hibernate.dialect.SQLServerDialect
    </prop>
    <prop key="hibernate.show_sql">true</prop>
    </props>
    </property>
    </bean>


    <bean id="tempDAO" class="cn.liang.dao.TempDAO" >
    <property name="sessionFactory">
    <ref bean="sessionFactory"></ref>
    </property>
    </bean>

    <bean id="tempBizImpl" class="cn.liang.service.TempBizImpl">
    <property name="tempDAO">
    <ref bean="tempDAO"></ref>
    </property>
    </bean>
    <bean name="/reg" class="cn.liang.struts.RegAction" scope="prototype">
    <property name="tempBizImpl" ref="tempBizImpl"/>
    </bean>

    <bean name="/show" class="cn.liang.struts.IndexAction" scope="prototype">
    <property name="tempBizImpl" ref="tempBizImpl"/>
    </bean>
    <bean name="/login" class="cn.liang.struts.LoginAction" scope="prototype">
    <property name="tempBizImpl" ref="tempBizImpl"/>
    </bean>

    <!-- 配置transactionManager  -->
     <bean id="transactionManager" 
      class="org.springframework.orm.hibernate3.HibernateTransactionManager">
      <property name="sessionFactory">
       <ref local="sessionFactory" />
      </property>
     </bean>

     
     <!-- 配置事务代理,对TempDAO的insert,和get方法进行不同的事务配置 -->
     <bean id="tempDAOProxy" 
    class="org.springframework.transaction.interceptor.TransactionProxyFactoryBean">
      <property name="transactionManager">
       <ref bean="transactionManager" />
      </property>
      <property name="target">
       <ref local="tempDAO" />
      </property>
      <property name="transactionAttributes">
      <props>
       <prop key="insert*">PROPAGATION_REQUIRED</prop>
       <prop key="update*">PROPAGATION_REQUIRED</prop>
       <prop key="delect*">PROPAGATION_REQUIRED</prop>
      </props>
      </property>
    </bean>
    </beans>
      

  5.   

    -----------------------------------------------------
    我的applicationContext_pojo.xml
    <?xml version="1.0" encoding="UTF-8"?>
    <beans
    xmlns="http://www.springframework.org/schema/beans"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd"> <bean id="admin" class="cn.liang.pojo.Admin"></bean>
    <bean id="answer" class="cn.liang.pojo.Answer"></bean>
    <bean id="item" class="cn.liang.pojo.Item"></bean>
    <bean id="qestion" class="cn.liang.pojo.Question"></bean>
    <bean id="subitem" class="cn.liang.pojo.Subitem"></bean>
    <bean id="users" class="cn.liang.pojo.Users"></bean>  
     
    </beans>--------------------------------------------------
    我的struts-config.xml<?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE struts-config PUBLIC "-//Apache Software Foundation//DTD Struts Configuration 1.2//EN" "http://struts.apache.org/dtds/struts-config_1_2.dtd"><struts-config>
      <data-sources />
      <form-beans />
      <global-exceptions />
      <global-forwards />
      <action-mappings >
        <action path="/reg" 
        type="org.springframework.web.struts.DelegatingActionProxy"
        validate="false">
          <forward name="succ" path="/index.jsp" />
          <forward name="err" path="/jsp/err.jsp" />
        </action>
        <action path="/show" type="org.springframework.web.struts.DelegatingActionProxy">
          <forward name="show" path="/show.jsp?flag=login" />
          <forward name="err" path="/jsp/err.jsp" />
        </action>
        <action path="/login" type="org.springframework.web.struts.DelegatingActionProxy">
         <forward name="login" path="/show.jsp?flag=login" />
          <forward name="err" path="/jsp/err.jsp" />
        </action>  </action-mappings>  <message-resources parameter="cn.liang.struts.ApplicationResources" />
      
      <plug-in className="org.springframework.web.struts.ContextLoaderPlugIn">
        <set-property property="contextConfigLocation" value="/WEB-INF/applicationContext.xml" />
      </plug-in>
    </struts-config>