程序原理:jsp中输入stime,etime,提交到action,生成fusioncharts所需数据,返回jsp,更新FushionChart.问题:action中不能获取stime,etime数据。debug发现他们的只均为null。请求朋友们指点迷津。
本人无分可给,十分抱歉。jps代码如下:<html>
<script language="javascript">
function submitForm(){
document.forms[0].submit();
}
</script>
<head>
</head>
<body>
<html:form action="/analyse" method="get" >
<table align="center" width="500" border="0" cellpadding="0"
cellspacing="0">
<tr>
<td height="25" class="td_bgColor" width="25%">
<div align="right">起始日期:</div>
</td>
<td height="25" class="td_bgColor" width="25%">
<div align="left"><input type="text" id="stime" name="stime" readonly="readonly" /></div>
</td>
<td height="25" class="td_bgColor" width="25%">
<div align="right">结束日期:</div>
</td>
<td height="25" class="td_bgColor" width="25%">
<div align="left"><input type="text" id="etime" name="etime" readonly="readonly" /></div>
</td>
</tr>
</table>
<table align="center" width="500" border="0" cellpadding="0">
<tr>
<td height="25" colspan="4" class="td_bgColor_right">
<div align="center">
<button onClick="submitForm();">
开始查询
</button>
</div>
</td>
</tr>
</table>
<input type="hidden" name="dispatch" value="bk" />
</html:form> <fieldset>
<legend>
图形区
</legend>
<div id="chartdiv" align="center">FusionCharts. </div>
<script type="text/javascript">
var chart = new FusionCharts("/stocks/components/FusionCharts/MSColumn3D.swf", "ChartId", "1024", "600", "0", "0");
var stime=document.getElementById("stime");
var etime=document.getElementById("etime");
chart.setDataURL("/stocks/analyse.do?dispatch=bkChar1&stime="+stime.value+"&etime="+etime.value);
chart.render("chartdiv");
</script>
</fieldset>
</body>
</html>
action代码如下: public ActionForward bkChar1(ActionMapping mapping, ActionForm form,
HttpServletRequest request, HttpServletResponse response) {
//生成图形所需数据
MyForm myForm = (MyForm ) form;
String stime = (String) request.getParameter("stime");
String etime = (String) request.getParameter("etime");
..................
本人无分可给,十分抱歉。jps代码如下:<html>
<script language="javascript">
function submitForm(){
document.forms[0].submit();
}
</script>
<head>
</head>
<body>
<html:form action="/analyse" method="get" >
<table align="center" width="500" border="0" cellpadding="0"
cellspacing="0">
<tr>
<td height="25" class="td_bgColor" width="25%">
<div align="right">起始日期:</div>
</td>
<td height="25" class="td_bgColor" width="25%">
<div align="left"><input type="text" id="stime" name="stime" readonly="readonly" /></div>
</td>
<td height="25" class="td_bgColor" width="25%">
<div align="right">结束日期:</div>
</td>
<td height="25" class="td_bgColor" width="25%">
<div align="left"><input type="text" id="etime" name="etime" readonly="readonly" /></div>
</td>
</tr>
</table>
<table align="center" width="500" border="0" cellpadding="0">
<tr>
<td height="25" colspan="4" class="td_bgColor_right">
<div align="center">
<button onClick="submitForm();">
开始查询
</button>
</div>
</td>
</tr>
</table>
<input type="hidden" name="dispatch" value="bk" />
</html:form> <fieldset>
<legend>
图形区
</legend>
<div id="chartdiv" align="center">FusionCharts. </div>
<script type="text/javascript">
var chart = new FusionCharts("/stocks/components/FusionCharts/MSColumn3D.swf", "ChartId", "1024", "600", "0", "0");
var stime=document.getElementById("stime");
var etime=document.getElementById("etime");
chart.setDataURL("/stocks/analyse.do?dispatch=bkChar1&stime="+stime.value+"&etime="+etime.value);
chart.render("chartdiv");
</script>
</fieldset>
</body>
</html>
action代码如下: public ActionForward bkChar1(ActionMapping mapping, ActionForm form,
HttpServletRequest request, HttpServletResponse response) {
//生成图形所需数据
MyForm myForm = (MyForm ) form;
String stime = (String) request.getParameter("stime");
String etime = (String) request.getParameter("etime");
..................
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货