润乾报表分析1-通过url将参数传达给报表

<% @ page contentType = " text/html;charset=GBK "   %>
<% @ taglib uri = " /WEB-INF/runqianReport4.tld "  prefix = " report " %>
<% @ page  import = " java.util.* "   %>
<% @ page  import = " java.io.* "   %>
<% @ page  import = " com.runqian.report4.model.* " %>
<% @ page  import = " com.runqian.report4.usermodel.* " %>
<% @ page  import = " com.runqian.report4.util.* "   %>
< html >         
< head >
< title > 润乾报表4. 0 </ title >
</ head >
<%
    
// 根据报表,生成参数与宏的字符串
    request.setCharacterEncoding( " GBK " );
    String report
= request.getParameter( " report " );
           
if (report.indexOf( " .raq " ) < 0 ) report += " .raq " ;

    
// 第一步,读取报表模板
    InputStream fis = application.getResourceAsStream( " /reportFiles/ " + report);
    ReportDefine rd 
=  (ReportDefine)ReportUtils.read( fis );
    
// 第二步,生成报表所需要的宏或参数的字符串
    ParamMetaData pmd  =  rd.getParamMetaData();
    StringBuffer params 
=   new  StringBuffer();
    String temp 
=   "" ;
    
if (pmd  !=   null ) {
        
int pmdNum = pmd.getParamCount();    //取得报表中参数个数
        for(int i = 0;i <pmdNum; i ++){
            temp 
= pmd.getParam(i).getParamName();   //取得其中参数名
            params.append( temp );
            params.append(
"=");
            params.append(request.getParameter(temp));   
//根据参数名找到url传递过的参数值
            params.append(";");
        }

    }

    MacroMetaData mmd 
=  rd.getMacroMetaData();        // 同上,只是取得宏而已
     if (mmd  !=   null ) {
        
int mmdNum = mmd.getMacroCount();
        
for(int i = 0; i < mmdNum; i ++){
            temp 
= mmd.getMacro(i).getMacroName();
            params.append( temp );
            params.append(
"=");
            params.append(request.getParameter(temp));
            params.append(
";");
        }

    }

%>
< body >

< report:html  name = " report1 "  reportFileName = " <%=report%> "
    funcBarLocation
= " top "
    params
= " <%=params.toString()%> "
/>
</ body >
</ html >
  有个问题是:如何将参数表单中的参数和url中参数联合起来,传递给报表???
也就是当点参数表单中的查询时顺便要将url中参数也传进报表?

<% String num=request.getParameter("num");
String num_param="num="+num; %>
<report:param name="report0" paramFileName="graph_itemNo_param.raq" needSubmit="" hiddenParams="<%=num_param %>" />

你可能感兴趣的:(html,String,report,url,import,报表)