jsp向servlet传值,返回刷新后的页面有关问题

jsp向servlet传值,返回刷新后的页面问题
jsp页面中,点击查询按钮向servlet发送请求,但是servlet没反应,断点跳不进去,是不是js的写法有问题,请指点一下,以下是servlet代码和jsp代码。
package com.ruixin.servlet;

import java.io.IOException;
import java.util.List;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import com.ruixin.dao.ReportDao;

public class ReportServlet extends HttpServlet {

private static final long serialVersionUID = 1L;

/**
 * 请求Servlet方法
 */
protected void doGet(HttpServletRequest req, HttpServletResponse resp)
throws ServletException, IOException {

String code = req.getParameter("code");
String type = req.getParameter("type");
String startDate = req.getParameter("startDate");
String endDate = req.getParameter("endDate");

ReportDao reportDao=new ReportDao();
List reportList=reportDao.getReportInfo(code, startDate, endDate,type);
req.setAttribute("reportList", reportList);
req.setAttribute("oldcode", code);
req.setAttribute("type", type);
req.getRequestDispatcher("report.jsp").forward(req, resp);
}

}


report.jsp
<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@ page import ="java.util.*,com.ruixin.entity.*"%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<script type="text/javascript">
   window.onload = function(){
   /*获取返回列表信息,插入到表格中*/
    var tb = document.getElementById("tb");
    var totalMoney=0;
    var totalUseNum=0;
    <%
     List reportList=(List)request.getAttribute("reportList");
for(int i=0;i<reportList.size();i++){
Report report=(Report)reportList.get(i);
%>
  totalMoney = totalMoney+<%=report.getMoney()%>;
  totalUseNum = totalUseNum+<%=report.getUseNum()%>;
  var tr=document.createElement('tr');
        var td1=document.createElement('td');
        var td2=document.createElement('td');
        var td3=document.createElement('td');
        var td4=document.createElement('td');
        td1.innerText='<%=report.getCode()%>';
        td2.innerText='<%=report.getName()%>';
        td3.innerText='<%=report.getUseNum()%>';
        td4.innerText='<%=report.getMoney()%>';
        tr.appendChild(td1);
        tr.appendChild(td2);
        tr.appendChild(td3);
        tr.appendChild(td4);
        tb.appendChild(tr);
<%
}
%>
//添加合计
var tr=document.createElement('tr');
        var td1=document.createElement('td');
        var td2=document.createElement('td');
        var td3=document.createElement('td');
        var td4=document.createElement('td');
        td1.innerText='合计';
        td2.innerText='';
        td3.innerText=totalUseNum;
        td4.innerText=totalMoney;
        tr.appendChild(td1);
        tr.appendChild(td2);
        tr.appendChild(td3);
        tr.appendChild(td4);
        tb.appendChild(tr);
        
        //设置起止日期
        /*获得当月第一天和最后一天日期*/
var myDate = new Date();
    var year = myDate.getFullYear();
    var month = myDate.getMonth()+1;
    if (month<10){
        month = "0"+month;
    }
    var firstDay = year+"-"+month+"-01";

    myDate = new Date(year,month,0);
    var lastDay = year+"-"+month+"-"+myDate.getDate();
    
    document.getElementById("startDate").value=firstDay;
    document.getElementById("endDate").value=lastDay;
    
    <%String oldcode=(String)request.getAttribute("oldcode");%>
    var oldcode = "<%=oldcode%>";
         <%String type=(String)request.getAttribute("type");%>
    var type = "<%=type%>";
   }
   
//就是这里出的问题
   /*查询事件*/
   function search(){
    var startDate =  document.getElementById("startDate").value;
    var endDate =  document.getElementById("endDate").value;
    parent.frames["rightFrame"].location="/Struts2Project/Report?code="+oldcode+"&type="+type+"&startDate="+startDate+"&endDate="+endDate;
    //window.location.href="/Struts2Project/Report?code="+oldcode+"&type="+type+"&startDate="+startDate+"&endDate="+endDate;
    //location.replace(location.href="/Struts2Project/Report?code="+oldcode+"&type="+type+"&startDate="+startDate+"&endDate="+endDate);
   }
   
   
</script>
</head>
  
<body>
<div align="center">
  <p>电费统计报表</p>
  开始日期<input type="text" value="" id="startDate" style="width:120px">
  结束日期<input type="text" value="" id="endDate" style="width:120px" >
  <input type="button" onclick="search();" value="查询">
  <br/><br/>
  <table width="400" border="0" id="tb">
    <tr>
      <td width="150">编码</td>
      <td width="150">电表名称</td>
      <td width="150">用电量</td>
      <td width="150">金额</td>
    </tr>
  </table>
</div>
</body>
  
</html>


主页面main.jsp
<%@ page language="java" import="java.util.*" pageEncoding="gb2312"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme() + "://"
+ request.getServerName() + ":" + request.getServerPort()
+ path + "/";
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
</head>
<frameset rows="106,*" frameborder="no" border="0" framespacing="0">
<frame src="head.jsp" name="topFrame" scrolling="No" noresize="noresize" id="topFrame" title="topFrame" />
<frameset cols="236,*" frameborder="no" border="0" framespacing="0" id="meFrame">
<frame src="left.jsp" name="leftFrame" scrolling="No"
noresize="noresize" id="leftFrame" title="leftFrame" />
<frame src="right.jsp" name="rightFrame" id="rightFrame"
title="rightFrame" scrolling="auto" ><input id="abc" text="abc" value="abc" name="abc" ></frame>
</frameset>
</frameset>
<noframes>
<body></body>
</noframes>
</html>

------解决思路----------------------
       function search(){
               var startDate =  document.getElementById("startDate").value;
               var endDate =  document.getElementById("endDate").value;
alert(111111);///////增加这句看执行到了没有
             /* parent.frames["rightFrame"].location="/Struts2Project/Report?code="+oldcode+"&type="+type+"&startDate="+startDate+"&endDate="+endDate;*/

//===>


parent.frames["rightFrame"].src=="/Struts2Project/Report?code="+oldcode+"&type="+type+"&startDate="+startDate+"&endDate="+endDate;
       }