action="cfqy_left.jsp"
-----------------------------<table width="100%" border="0" align="center" cellpadding="0" cellspacing="0">   
   <tr>
    <td>
        起始日期:<input type="text" size="8" id="startid"  name="stattime" disabled="disabled" onclick="SelectDate(this)"/>
          结束日期:<input  type="text" size="8" id="endid" name="endtime" disabled="disabled" onclick="SelectDate(this)"/> 
    <input type="submit" value="提交" onclick="bijiaotime()"/>
    </td>
   </tr>提交到action(当前页) ;
为什么当我提交后,文件框里面的值就没有了? 实际中需要保留下来,这里应该怎么处理.谢谢?

解决方案 »

  1.   

    代码: 
    <%       
       String stattime = request.getParameter("stattime");
       String endtime = request.getParameter("endtime"); 
      
            Statement stmt = conn.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE, ResultSet.CONCUR_UPDATABLE);
    ResultSet rs = null;
    if(stattime==null && endtime==null || stattime=="" && endtime=="")
    {
    rs = stmt.executeQuery("SELECT * FROM `t_news` WHERE newstypeid=6 order by ntime desc limit 7 ");
    }else {
    rs = stmt.executeQuery("SELECT * FROM `t_news` WHERE newstypeid=6 and  ntime  between  '"+stattime+" 00:00:00' and '"+endtime+" 00:00:00' order by ntime desc limit 50 ");
    }
    while (rs.next()) {
        %> 
         <%
         java.util.Date date;
         String sdate;
         date = rs.getDate("ntime");
         sdate = (new SimpleDateFormat("dd日").format(date));
         int id0 = rs.getInt("id");//获取id,传递参数到cfqy_right.jsp页面
         %>   
      

  2.   

    1确定:
    起始日期: <input type="text" size="8" id="startid"  name="stattime" disabled="disabled" onclick="SelectDate(this)"/> 
          结束日期: <input  type="text" size="8" id="endid" name="endtime" disabled="disabled" onclick="SelectDate(this)"/> 
    在form中。2提交之前alert一下,看能否有stattime和endtime的值3看下后台取值是否存在问题4或许你的js控件根本没把值放到text中
      

  3.   

    你alert 一下  stattime 看有值吗再一个stattime=="" && endtime==""判断也不多 应该是stattime.equals("")
      

  4.   

    这样试试:
    action="cfqy_left.jsp" 
    ----------------------------- <table width="100%" border="0" align="center" cellpadding="0" cellspacing="0">  
      <tr> 
      <td> 
          起始日期: <input type="text" size="8" id="startid"  name="stattime" value="<%= request.getParameter("stattime")%>" disabled="disabled" onclick="SelectDate(this)"/> 
          结束日期: <input  type="text" size="8" id="endid" name="endtime" value="<%=request.getParameter("endtime")%>" disabled="disabled" onclick="SelectDate(this)"/> 
      <input type="submit" value="提交" onclick="bijiaotime()"/> 
      </td> 
      </tr> 提交到action(当前页) ; 
    为什么当我提交后,文件框里面的值就没有了? 实际中需要保留下来,这里应该怎么处理.谢谢?