错在哪里?(用隐藏表单传递值,并提交到本页面) new SimpleDateFormat("yyyy-mm-dd");yyyy-MM-dd 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 hy.submit()?怎么不是form2.submit()?hy不是那个隐藏变量吗? country2s.length==0或country2s==null时怎么办呢? <%@ 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> 我把程序改为如上所述,还是显示不出结果。用tomcat发布,没有出错提示信息 <xml src="c:\\root\\123.xml"></xml>无法读取 求趋向于java方面数据库编程,网络编程,流媒体处理实践性比较强的面试题一份 STRUTS与AJAX结合的问题 怎样用gzip来压缩jsp? 再线等待!!!!JSP问题 请问学JSP是不是应该很熟悉html 请问各位:怎样将页面数据导出成DBF文件格式? 谢谢! TOMCAT 5 怎么支持中文? struts中如何用server.xml,web.xml连接数库 如何将TOMCAT加为2000的服务? 精通JS的朋友进来看看你会不会!急呀,谢谢,一定要求个答案 如何在更改1.jsp页面成功后,刷新2.jsp呢?
怎么不是form2.submit()?
hy不是那个隐藏变量吗?
<%@ 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>