new SimpleDateFormat("yyyy-mm-dd");yyyy-MM-dd

解决方案 »

  1.   

    hy.submit()?
    怎么不是form2.submit()?
    hy不是那个隐藏变量吗?
      

  2.   

    country2s.length==0或country2s==null时怎么办呢?
      

  3.   

    <%@ page contentType="text/html; charset=GBK" %>
    <%@ page language="java" import="java.util.*" %>
    <%@ page import="com.tassie.firmgoal.model.*" %>
    <%@ page import="com.tassie.firmgoal.dao.*" %><%@ page import="java.text.SimpleDateFormat" %><html>
    <head>
    <title>
    </title>
    </head>
    <body><%    String msg="";

    String countryName=request.getParameter("countryName");

    String year=request.getParameter("year");

    String month=request.getParameter("month");

    String day=request.getParameter("day");

    String reportTemplateUid=request.getParameter("reportTemplateUid"); 


      if(countryName!=null)
       {
       
       Country[] countrys = CountryDAO.findByName("countryName");

       Country country = null;
       
      if(countrys.length>0)
    {
    country = countrys[0];
    }
    else{

    msg="出错啦";

    }
     
     
       
    String country_uid = country.getUid();

       

     SimpleDateFormat df = new SimpleDateFormat("yyyy-mm-dd");

    Date fDate = df.parse(year+"-"+month+"-"+day);


    ReportInstance[] reportInstances = ReportInstanceDAO.findInstance(reportTemplateUid,fDate);

    ReportInstance reportInstance = null;

    if(reportInstances.length>0){

      reportInstance = reportInstances[0];
      
      

    else{

    msg="出错啦!";



    String reportInstance_uid = reportInstance.getUid();




    response.sendRedirect("http://127.0.0.1:8080/ReportWeb/ReportView.jsp?country_uid="+country_uid+"reportInstance_uid="+reportInstance_uid);

    System.out.println(msg);
        }

    %>
       <p>
    <form name="form1" method="post" action="ReportView.jsp"><select name=""><option value="shangdong" selected>山东</option></select>
    省      <select name="bigsortselect"  onChange="changelocation(document.form1.bigsortselect.options[document.form1.bigsortselect.selectedIndex].value)" 
                                          size="1"> 
      
      <option selected>---------------</option>
      
      <%
      
      Country[] countrys = CountryDAO.findByCode("00");
       
      for(int i=0;i<countrys.length;i++)
      {
    Country country = (Country)countrys[i];

     
      %>
      
      <option value="<%=country.getUid()%>"><%=country.getName()%> </option>
      
      
    <%

      }
      
       %>
     </select>

       <select name="smallsortselect" size="" >
       
          <option selected>---------------</option> </select>
    县<script language="JavaScript">    
     
        subcat = new Array();
        <%
    for(int i=0;i<countrys.length;i++)
    {
         Country country =(Country) countrys[i];
        
            Country[] country1s = CountryDAO.findByCode(country.getCode());
               
            for (int m=0; m<country1s.length; m++)
            { 
             Country country1 = (Country)country1s[m];
            %>
                subcat[<%=m%>] = new Array("<%=country1.getName()%>","<%=country.getUid()%>","<%=country1.getUid()%>");
                <%
             }
        }
        %>
        
       
        
    function changelocation(uid)
        {
            document.form1.smallsortselect.length = 0; 
        document.form1.smallsortselect.options[0] = new Option("","");     for (j=0;j < subcat.length; j++)
            {
                 if(subcat[j][1]==uid)
                 {
                    document.form1.smallsortselect.options[document.form1.smallsortselect.length] = new Option(subcat[j][0]);
                 }      
            }
            
        }      
      
        changelocation(document.form1.bigsortselect.options[document.form1.bigsortselect.selectedIndex].value);
        
    </script><br>
    <select name="">
    <option value="" selected></option>
    <option value="" >2005</option>
    </select>年<select name="">
    <option value="" selected></option>
    <option value="" >1</option>
    <option value="" >3</option>
    <option value="" >5</option>
    <option value="" >7</option></select>月<select name="">
    <option value="" selected></option>
    <option value="" >15</option>
    </select>日<br><input type="submit" value="提交">
    <input type="submit" value="修改">
    </form><form name="form2" method="post" action="ReportView.jsp"  ><%
     
      
      Country[] country2s = CountryDAO.findByName("countryName");

      for(int i=0;i<country2s.length;i++)
      
      {
      
      Country country2 = (Country)country2s[i];
      
     
     
         String country_uid = country2.getUid();
        
    %>
    <input type="hidden" value="<%=country_uid%>" name="hy">

    <%
    }
    %>

    <%        SimpleDateFormat df = new SimpleDateFormat("yyyy-mm-dd");

    Date fDate = df.parse(year+"-"+month+"-"+day);   ReportInstance[] reportInstance2s = ReportInstanceDAO.findInstance(reportTemplateUid,fDate);

    for(int n=0;n<reportInstance2s.length;n++)
    {
     ReportInstance reportInstance2=(ReportInstance)reportInstance2s[n];
     
           String reportInstance_uid = reportInstance2.getUid();
    %>

       <input type="hidden" value="<%=reportInstance_uid%>" name="hy">
       <%
       }
       %>

    </form><script>form2.submit()</script></body></html>
      

  4.   

    我把程序改为如上所述,还是显示不出结果。用tomcat发布,没有出错提示信息