パラメータの受け渡し方法

  • 作成者:ayuan0625
  • 編集回数:13次
  • 最終更新:FRInternational 于 2021-05-13
  • I. Description

    In JS calls FR print method, we mentioned that JS calls the FR print method to pass parameters in two ways: post passing parameters and get passing parameters. So what is the difference between these two parameter passing methods? Let's talk about it in detail below.

    Note: When the JAR package version is 2018-04-09 and above, please use the new printing method. For details, please refer to: Print Settings.

    II. Parameter transfer method

    1) Get pass parameters

    The parameter passing method of get is to splice the parameters behind the URL in the form of parameter 1=parameter value 1&parameter 2=parameter value 2 for transmission. For example, use js to call Flash to print a template and pass 2 parameters to the In the template, then the URL code for parameter printing in the get method is:

    http://localhost:8075/webroot/decision/view/report?viewlet=report.cpt&p1=a&p2=b

    The complete code for JS to call the FR print method is:

    var url="http://localhost:8075/webroot/decision/view/report?viewlet=report.cpt&p1=a&p2=b";
    var isPopUp = false;
    var config = {url : url,isPopUp : isPopUp}
    FR.doURLPDFPrint(config);

    2) Post parameter transfer

    The post parameter passing method uses the parameters as the content of the http request and sends them to the specified URL. They are not spliced in the URL. The URL is as follows:

    http://localhost:8075/webroot/decision/view/report

    The parameters will be passed in a special format, the complete code is as follows:

        var printurl="http://localhost:8075/webroot/decision/view/report";       
        var reportlets ="[{reportlet: '1.cpt', p1: 'a'}]";  
        var config = {  
                url : printurl,  
                isPopUp : false,  
                data : {  
                        reportlets: reportlets 
                    }  
        };FR.doURLPDFPrint(config);

    The parameters passed by post parameters are invisible, and the confidentiality is better.

    Note 1: Both the 10.0 designer and deployment package use openjdk, and flash printing cannot be started using openjdk, but Oracle/sun jdk can be used.

    Note 2: Flash printing is currently an obsolete technology. Many browsers will no longer support flash printing. It is recommended that customers use zero client or local printing.

    III. Length comparison

    Through the different ways of parameter passing, we can see that the length of the URL will be much longer than the post method when passing parameters through the get method. This means that the length of the parameters passed by the get is limited. If it exceeds the length limit of the URL, then Data transmission is not possible, but the post method does not have this limitation. The length of the URL is fixed, and it does not become longer with the increase of parameters.

    Attachment List


    Theme: FineReport 帳票実例
    既に最初
    既に最後
    • Helpful
    • Not helpful
    • Only read