一个旅游线路报价单的页面,旅游线路已经事先输入好了,有2天的,或者4或者7天的,原来的页面只有第一天到最后一天的行程,例如:
日期       上午行程             下午行程
 1          参观天安门         参观颐和园
 2          参观十三陵          参观定陵
其中的日期值是自动赋予的。现在,当在页面输入开始时间后,下面的日期要变成这样:
日期       上午行程             下午行程
3月11日    参观天安门         参观颐和园
3月12日    参观十三陵          参观定陵
请教高手该怎样解决?

解决方案 »

  1.   

    我觉得先建一个HTML页面 输入时间后
    <form action="Request.jsp" method="GET">
    StartDate:<input type="text" name="StartDate" size="20" maxlength="20"><br>
    <input type="submit" value="传送">
    </form>
    再将请求转给JSP页面(在Request.jsp中加上)
    <%javga.lang.String x=request.getParameter("StartDate")%>
    就可以得到你输入的那个开始日期的字符串,再按照正常情况在JSP里面处理就是了不过用JSP做似乎是有些麻烦 毕竟要传个请求到服务器上
    又不是做JSP就不能用其他的技术 这个其实直接使用JavaScript就可以在客户端实现了 用JSP太浪费了
      

  2.   

    我的意思是 你的服务器上有两个页面 一个html页面用来显示原来那个用序号表示内容 而jsp页面用来处理后返回一个新页面 用户登录 就登录那个html页面 然后通过<input type="submit" value="传送">调转到jsp网页上也就是说 提交请求前是原来日期的位置是数字序号的真正的html静态网页 而后面得到的是jsp动态生成的页面 而且jsp在计算日期返回页面的同时 就附带做数据库操作就是了 至于怎么计算日期 你可以用java自己带的日期时间类 也可以自己写一个类嘛
      

  3.   

    <input type="text" id="month">月<input type="text" id="day">日<input type="button" onClick="writeDate(2);" value="插入日期">
    <table border="1">
    <tr>
    <td>日期</td>
    <td>上午行程</td>
    <td>下午行程</td>
    </tr>
    <tr>
    <td id="row1"> 1 </td>
    <td>参观天安门</td>
    <td>参观颐和园</td>
    </tr>
    <tr>
    <td id="row2"> 2 </td>
    <td>参观十三陵</td>
    <td>参观定陵</td>
    </tr>
    </table>
    <script>
    function writeDate(num){
    var d=new Date();

    d.setMonth(document.getElementById("month").value);
    d.setDate(document.getElementById("day").value);

    for(var i=1;i<=num;i++){
    document.getElementById("row"+i).innerHTML=d.getMonth()+1+"月"+d.getDate()+"日";
    d.setDate(d.getDate()+1);
    }
    }
    </script>
      

  4.   

    你开始日期是输入的字符串还是用CALENDA得到的DATE类型
      

  5.   

    你如果要写数据库的话 就用JSP咯输入的是字符串嘛 因为在JSP中用request.getParameter("StartDate")只能得到String型了这里如果用JavaScript实现的了客户端那边的页面变化 但是服务器上的数据库就不好弄了
      

  6.   

    这个方法应该能解决LZ的问题了
    假设客户选择7日的行程,取当前日期public void getDate(){
    Date myDate = new Date(System.currentTimeMillis());
    Calendar calCur = Calendar.getInstance();
    calCur.setTime(myDate);  
    int day = calCur.get(Calendar.DAY_OF_MONTH);//当前日期前一天   
    calCur.add(Calendar.MONTH,1);
    int month = calCur.get(Calendar.MONTH);
    //calCur.add(Calendar.DAY_OF_MONTH,1);//当前日期后一天
    for(int i=0; i<7; i++){
    int curDay = day+i;
    String date = month+"月"+curDay+"日";
    System.out.println(date);
    }
      

  7.   


       int journeyListLength = 0;
       int priceListLength  = 0;
       List allLine = QuotationMng.getAllLine();
       
       String protecolType = ("818");
    List<ResCopartnerInfo> clientList = (List<ResCopartnerInfo>)ResCopartnerDataDeal.getCopartnerDataDeal().getCopartnerDataFromeComType(protecolType);
    List<ResInitInfo> dataList = (List<ResInitInfo>)DataInitDeal.getDataInitDeal()
    .getDataInitRecordFromType(protecolType);
    %>
    <body leftMargin=0 topMargin=0 onLoad="initQuoManAndLine()">
    <FORM method="post" name="form1" id="forml" action="">
    <table width="100%" border="0" cellpadding="0" cellspacing="1">
      <tr>
        <td><table width="100%" border="0" cellspacing="1" cellpadding="0">
      <tr> 
        <td height="10" ></td>
      </tr>
      <tr> 
        <td><img src="../LOGOPhoto/TopLogo.jpg"></td>
      </tr>
      <tr> 
        <td height="8" background="../Style/03Img/bottombg.gif" ></td>
      </tr>
    </table></td>
      </tr>
      <tr>
        <td><table width="100%" border="1" cellpadding="0" cellspacing="0" bordercolorlight="#808080" bordercolordark="#FFFFFF" class="black">
      <tr bgcolor="#D4D0C8" class="black"> 
        <td style="background-color:#D4D0C8" width="9%" align="center">部&nbsp;&nbsp;门</td>
        <td width="27%"><input name="quoMan" type="text" value="<%=quoMan%>"></td>
        <td width="10%" align="center">操作人</td>
        <td width="15%">&nbsp;<%=linkman%></td>
        <td width="7%" align="center">状态</td>
        <td width="7%"><font color="#FF0000">新增</font></td>
        <td width="9%" align="center">报价单号</td>
        <td width="15%"><font color="#FF0000">待系统生成</font>
          <input type="hidden" name="newQuoId"></td>
      </tr>
      <tr bgcolor="#FFFFFF"> 
        <td width="9%" align="center">选择线路</td>
        <td width="19%"> <select name="line" onChange=changeLine("Quotation_A.jsp?flag=1") class="inputp">
    <option value="0">
    ---请选择线路---
    </option>
    <%
     for(int i=0;i<allLine.size();i++)
     {
     ResLineBasicInfo Jou = (ResLineBasicInfo)allLine.get(i);
        %>
    <option value="<%=Jou.getNumber()%>"><%=Jou.getLineName()%></option>
    <%
    }
    %>
    </select>
    <%
    if (flag != null && flag.equals("1"))
    {
    ResLineBasicInfo LineInfo =QuotationMng.getresLineInfo(request.getParameter("line"));     
    %>
    <input type="hidden" name="lineName" value="<%=LineInfo.getLineName()%>">
    <%
    }
    %>
    </td>
        <td width="8%" align="center">报价单名称</td>
        <td><input name="QuoName" type="text" value="<%=(request.getParameter("QuoName") == null) ? "": request.getParameter("QuoName")%>"></td>
        <td align="center">单&nbsp;价</td>
        <td colspan="3"><table width="100%" border="0" cellpadding="0" cellspacing="0" class="black">
          <tr>
            <td width="20%" align="center">成人:</td>
            <td width="30%" align="center"><%
    if (flag != null && flag.equals("1"))
    {
    ResLineBasicInfo LineInfo =QuotationMng.getresLineInfo(request.getParameter("line"));
        
    %><input name="crj" type="text"  id="crj" size="4" value="<%=((LineInfo.getCrj()==null)?"":LineInfo.getCrj())%>">
            <%}else{%><input name="crj" type="text"  id="crj" size="4" value=""><%}%></td>
            <td width="20%" align="center">儿童:</td>
            <td width="30%" align="center"><%
    if (flag != null && flag.equals("1"))
    {
    ResLineBasicInfo LineInfo =QuotationMng.getresLineInfo(request.getParameter("line"));
        
    %><input name="etj" type="text"  id="etj" size="4" value="<%=((LineInfo.getEtj()==null)?"":LineInfo.getEtj())%>"><%}else{%><input name="crj" type="text"  id="etj" size="4" value=""><%}%></td>
          </tr>
        </table></td>
      </tr>
      <tr bgcolor="#FFFFFF"> 
        <td align="center">预抵日期</td>
        <td><table width="100%" border="0" cellpadding="0" cellspacing="0" class="black">
      <tr>
        <td width="40%" align="center"><input name="quotedate" type="text"  onfocus=calendar() value="<%=(request.getParameter("quotedate") == null) ? "" : request.getParameter("quotedate")%>" size=9  readonly></td>
        <td width="20%" align="center">至</td>
        <td width="40%" align="center"><input name="enddate" type="text"  border="1" onfocus=calendar() value="<%=(request.getParameter("enddate") == null) ? "" : request.getParameter("enddate")%>" size=9  readonly></td>
      </tr>
    </table></td>
        <td align="center">电&nbsp;&nbsp;话</td>
        <td><input name="tel" type="text" id="LinkTel" value="<%=tel%>"></td>
        <td align="center">组团社</td>
        <td colspan="3"><select name="zts" class="inputp">
            <option value="">--请选择组团社--</option>
         <%
           if (clientList != null){
           for (ResCopartnerInfo resCopartnerInfo :clientList){%>
           <option value=<%=resCopartnerInfo.getPartnerName() %>><%=resCopartnerInfo.getPartnerName() %>
           <%}
           }
           %>
          </select></td>
      </tr>
      <tr bgcolor="#FFFFFF"> 
        <td align="center">联系人</td>
        <td><input name="linkman" type="text" value="<%=linkman%>" size=10></td>
        <td align="center">手&nbsp;&nbsp;机</td>
        <td><input name="mobile" type="text" value="<%=(request.getParameter("mobile") == null) ? "": request.getParameter("mobile")%>"></td>
        <td align="center">传&nbsp;&nbsp;真</td>
        <td colspan="3"><input name="fax" type="text" value="<%=fax%>"></td>
      </tr>
    </table></td>
      </tr>
      <tr>
        <td><table width="100%" border="1" cellpadding="0" cellspacing="0" bordercolorlight="#808080" bordercolordark="#FFFFFF" class="black">
        <tr bgcolor="#FFFFFF" > 
          <td width="9%" align="center">线&nbsp;路<br>
            卖&nbsp;点</td>
          <td width="94%" colspan="5" >
      
      <textarea name="sellpoint" cols="50" rows="3" style="width:100%" onpropertychange="this.style.posHeight=this.scrollHeight"><%=(request.getParameter("sellpoint") == null) ? "":request.getParameter("sellpoint")%></textarea>      </td>
        </tr>
        
      </table></td>
      </tr>
      <tr>
        <td
      

  8.   

    这段就是要插入日期的代码处了!
    //////////////////////////////
    ><table width="100%" border="1" cellpadding="0" cellspacing="0" bordercolorlight="#808080" bordercolordark="#FFFFFF" class="black">
      <tr align="center" bgcolor="#D4D0C8" class="black" >
        <td width="6%" align="center">日期</td>
        <td width="10%">交通</td>
        <td width="31%">上午行程</td>
        <td width="31%">下午行程</td>
        <td width="12%">用餐</td>
        <td width="8%">酒店</td>
      </tr>
      
       <%
    if (flag != null && flag.equals("1"))
    {     
    List  JourneyList =QuotationMng.getresLineJourney(request.getParameter("line"));
    journeyListLength = JourneyList.size();
    for(int i=0;i<JourneyList.size();i++)
    {
    ResJourney Jou = (ResJourney)JourneyList.get(i);
    String serial = Jou.getSerial() ;
       String journey = Jou.getJourney() ;
       String shangwu = Jou.getShangwu() ;
       String xiawu = Jou.getXiawu() ;
       String zaocan = Jou.getZaocan() ;
       String wucan = Jou.getWucan() ;
       String wancan = Jou.getWancan() ;
       String jiudian = Jou.getJiudian() ;
        
    %>
      <tr onMouseOver="this.bgColor='#EFEFEF';" onMouseOut="this.bgColor='#FFFFFF';">
        <td align="center"><%=serial%></td>
        <td align="center"><input name="journey<%=serial%>" size="10" value="<%=journey%>"></td>
        <td align="center"><textarea name="shangwu<%=serial%>" cols="30" rows="1" id="shangwu" style="width:100%" onpropertychange="this.style.posHeight=this.scrollHeight"><%=shangwu%></textarea></td>
        <td align="center"><textarea name="xiawu<%=serial%>" cols="30" rows="1" id="xiawu" style="width:100%" onpropertychange="this.style.posHeight=this.scrollHeight"><%=xiawu %></textarea></td>
        <td align="center"><input name="A<%=serial%>" type="checkbox"  value="1" <% if(Jou.getZaocan().equals("1")){ %> checked <%}%>>
        <input name="B<%=serial%>" type="checkbox"  value="1" <%if(Jou.getWucan().equals("1")){%> checked <%}%>>
        <input name="C<%=serial%>" type="checkbox"  value="1" <% if(Jou.getWancan().equals("1")){ %> checked <%}%>> </td>
        <td align="center"><input name="jiudian<%=serial%>" type="text"  id="jiudian" size="12" value="<%=Jou.getJiudian()%>"></td>
      </tr>
       <%
    }
      }
    %></table></td>
      </tr>
      <tr>
        <td><table width="100%" border="1" cellpadding="0" cellspacing="0" bordercolorlight="#808080" bordercolordark="#FFFFFF" class="black">
        <tr bgcolor="#FFFFFF" > 
          <td width="6%" align="center">服务<br>
            标准</td>
          <td width="94%" colspan="5" >
      
      <textarea name="standard" cols="80" rows="3" style="width:100%" onpropertychange="this.style.posHeight=this.scrollHeight"><%
    if (flag != null && flag.equals("1"))
    {
    ResLineBasicInfo LineInfo =QuotationMng.getresLineInfo(request.getParameter("line"));     
    %>
    <%=((LineInfo.getServieStandard()==null)?"":LineInfo.getServieStandard())%>
    <%
    }
    %></textarea>
      
          </td>
        </tr>
        <tr bgcolor="#FFFFFF" >
          <td align="center">备注</td>
          <td colspan="5" >
      <textarea name="re" cols="80" rows="3" id="re" style="width:100%" onpropertychange="this.style.posHeight=this.scrollHeight"><%
    if (flag != null && flag.equals("1"))
    {
    ResLineBasicInfo LineInfo =QuotationMng.getresLineInfo(request.getParameter("line"));
        
    %>
    <%=((LineInfo.getRe()==null)?"":LineInfo.getRe())%>
    <%
    }
    %></textarea>
      
      </td>
        </tr>
      </table></td>
      </tr>
       <tr>
        <td><table width="100%" border="1" cellpadding="0" cellspacing="0" id=t bordercolorlight="#808080" bordercolordark="#FFFFFF" class="black"> 
      <tr align="center" bgcolor="#D4D0C8" class="black" >
        <td width="5%" height="20">序号</td>
        <td width="13%">类别</td>
        <td width="44%">项目名称</td>
        <td width="12%">单价</td>
        <td width="11%">数量</td>
        <td width="10%">金额</td>
        <td width="5%">删除</td>
      </tr>
    <%
    if (flag != null && flag.equals("1"))
    {
    List  PriceList =QuotationMng.getresLinePrice(request.getParameter("line"));
    priceListLength = PriceList.size();
    ResLinePrice Price;
    for(int i=0;i<5;i++)
    {
        if(i<PriceList.size())
    {
    Price = (ResLinePrice)PriceList.get(i);
    }
    else
    {
    Price = new ResLinePrice();
    }

    %>
      <tr bgcolor="#FFFFFF"> 
        <td align="center"> <strong><%=(i+1)%>&nbsp;</strong></td>
        <td align="center"><input name="ItemName" type="text" id="ItemName1<%=(i+1)%>" value="<%=((Price.getItemName()==null)?"":Price.getItemName())%>"></td>
        <td align="center"> <input name="ItemContent" type="text" id="ItemContent1<%=(i+1)%>" value="<%=((Price.getItemContent()==null)?"":Price.getItemContent())%>" style="width:95%"> </td>
        <td align="center"><input name="ItemPrice" type="text" id="ItemPrice<%=(i+1)%>" value="<%=((Price.getItemPrice()==null)?"":Price.getItemPrice())%>" size="10"></td>
        <td align="center"><input name="Times" type="text" id="Times<%=(i+1)%>"   size="10" value="0"></td>
        <td align="center"><input name="NumB" type="text" id="NumB<%=(i+1)%>"  value="0" size="6" onFocus="totalAccount()"></td>
        <td align="center"><input type=checkbox  name=c></td>
      </tr>
    <%
    }
    }
    %>
      <tr align="right" bgcolor="#FFFFFF"> 
        <td colspan="7"><input   type=button   value="del"   onclick="del()"> <span   id="s1">合计</span><strong>合计:负零元零角零分 ¥.00</strong> </td>
      </tr>
    </table></td>
      </tr>
       <tr>
    <td><table width="100%" border="0" align="center">
    <tr>
    <td height="25" align="center"> <input name="Save" type="button" onClick=checkForm("QuoSave.jsp?JLength=<%=journeyListLength%>&PLength=<%=priceListLength%>") value="保存">
    &nbsp;
    <input name="Exit" type="button" onclick=JavaScript:window.close()
    value="退出">   </td>
    </tr>
    </table></td>
    </tr>
    </table>
    </form> </body>
    </html>