Iowagie - How do I pass in parameter values to an event handler -onEndPage?

Hi,
I have spent a while on this and is getting quite frustrating, so any help much appreciated.
I am trying to create a footer on each of my PDF pages that will contain an image and a table. I have successfully created a separate class to my servlet, EndPage.java that contains an onEndPage() method. The problem is, I need to pass in three parameter values into this method, storeNo, langId and transNo.
How do I go about doing this?
PDFPrint.java
public class PDFPrint extends HttpServlet {
    private ByteArrayOutputStream getDoc(ByteArrayOutputStream baos, HttpServletRequest requ, String transNo, String storeNo, String langId)     {
        HttpSession session = requ.getSession();
        Document document = new Document();                    
        PdfWriter writer = PdfWriter.getInstance(document, baos);
        writer.setPageEvent(new EndPage());     
        document.open();
}EndPage.java
public class EndPage extends PdfPageEventHelper {
    public void onEndPage(PdfWriter writer, Document document) {
        try {
            Rectangle page = document.getPageSize();
            PdfPTable head = new PdfPTable(3);
            PdfPCell cell1 = new PdfPCell(new Phrase("Pueblo Nativo S.A. de C.V", FontFactory.getFont(FontFactory.HELVETICA, 17f)));
            cell1.setHorizontalAlignment(Element.ALIGN_LEFT);
            cell1.setBorder(0);
            for (int k = 1; k <= 1; ++k)
                 head.addCell(cell1);
            head.setTotalWidth(page.width() - document.leftMargin() - document.rightMargin());
            head.writeSelectedRows(0, -1, document.leftMargin(), page.height() - document.topMargin() + head.getTotalHeight(),
                      writer.getDirectContent());
            PdfPTable foot = new PdfPTable(1);
            PdfPCell cell = new PdfPCell(new Phrase("Disclaimer to go here.", FontFactory.getFont(FontFactory.HELVETICA, 17f)));          
            cell.setHorizontalAlignment(Element.ALIGN_CENTER);
            cell.setBorder(0);
            for (int k = 1; k <= 1; ++k)
                 foot.addCell(cell);
            foot.setTotalWidth(page.width() - document.leftMargin() - document.rightMargin());
            foot.writeSelectedRows(0, -1, document.leftMargin(), document.bottomMargin(),
            writer.getDirectContent());
        catch (Exception e) {
            throw new ExceptionConverter(e);
     public static void main(String[] args) {
}Thanks!

Try adding that information data as properties to the HTTP session.
FacesContext facesContext = FacesContext.getCurrentInstance();
ExternalContext externalContext = facesContext.getExternalContext();
HttpSession session = (HttpSession)externalContext.getSession(false);
session.setAttribute("stornNo", storeNo);
session.setAttribute("langId", langId);
session.setAttribure("transNo", transNo);In PDFPrint, you can get those properties using session's getAttribute method, and pass them to the constructor or as parameters to onEndPage.

Similar Messages

  • How can I pass URL parameter value to text field?

    Dear Masters,
    I have a text field. I want it to have a value based on the URL parameter, for example:
    http://myapplication.net:7777/pls/apex/f?p=102:1:::::P1_RTNUM:9448,P1_EMAILADD:email.add.here
    I want the value of the text field = P1_EMAILADD after the form was loaded. Also, please have it read-only.
    Thanks a lot.
    Edited by: user6368519 on Sep 16, 2009 11:39 PM

    Thanks Saad,
    Can I email you(I would need your email) for any concerns or just create a new thread for you to look?
    This is ok now. I'm sorry but I just marked this one as an "answered" one last time.
    Thanks for all the help again I appreciate it. ;)
    Thanks,
    Aaron
    [email protected]

  • Omniportler HTML Layout - How do I pass a parameter to another page?

    How do I pass a parameter to another page from an HTML Layout like I can with the Tabular layout?

    If I have a parameter I can pass it from one page to another, i.e. if I have a list of customers and I want data for that particular customer alone, I can create a page parameter form or an omniportlet where I would then pass the value of that portlet to the page. I would use a string like the following: https://test.test.com/test/page?_pageid=536,7483646&_dad=portal&_schema=test&customer=##CUSTOMER_NAME##

  • How can i pass the  parameter for strored procedure from java

    dear all,
    I am very new for stored procedure
    1. I want to write the strored procedure for insert.
    2. How can i pass the parameter for that procedure from java.
    if any material available in internet create procedure and call procedure from java , and passing parameter to procedure from java

    Hi Ram,
    To call the callable statement use the below sample.
    stmt = conn.prepareCall("{call <procedure name>(?,?)}");
    stmt.setString(1,value);//Input parameter
    stmt.registerOutParameter(2,Types.BIGINT);//Output parameter
    stmt.execute();
    seq = (int)stmt.getLong(2);//Getting the result from the procedure.

  • How can i pass the Input value to the sql file in the korn shell ??

    Hi,
    How can i pass the Input value to the sql file in the korn shell ??
    I have to pass the 4 different values to the sql file and each time i pass the value it has to generate the txt file for that value like wise it has to generate the 4 files at each run.
    can any one help me out.
    Raja

    Can you please more elaberate., perhaps you should more elaberate.
    sqlplus is a program. you start it from the korn shell. when it's finished, processing control returns to the korn shell. the korn shell and sqlplus do not communicate back and forth.
    so "spool the output from .sql file to some txt file from k shell, while passing the input parameters to the sql file from korn shell" makes no sense.

  • HOW CAN I PASS A DEFAULT VALUE IN INTERNAL TABLE

    HOW CAN I PASS A DEFAULT VALUE IN INTERNAL TABLE.
    DATA : BEGIN OF ITAB OCCURS 0,
               FIELD1(2) TYPC C DEFAULT   '12',
               FIELD2     TYPE C ,
               END OF ITAB1.
    IT'S GIVING ERROR MESSAGE.
    PLZ LOOK INTO THIS AND GIVE ME CORRECT SOLUTION.
    THANKS
    SURI

    DATA : BEGIN OF ITAB OCCURS 0,
    FIELD1(2) TYPC C,
    FIELD2 TYPE C ,
    END OF ITAB1.
    itab-field1 = '12'.
    itab-field2 = 'A'.
    append itab.
    clear itab-field2.
    itab-field1 = '12'.
    itab-field2 = 'B'.
    append itab.
    clear itab-field2.
    Now everytime u'll have the value for field1 = '12'.
    Regards
    Vasu

  • How can i pass a parameter to the query to filter the result of this lookup

    Hello,
    i'm developping a web application with JDeveloper 10.1.2 and JHeadStart.
    i realy need to know how can i filter the lookup (LOV) query result.
    in other word, when i click on the lookup, it show all the row that exist in may data base table.
    what i want is how can i pass a parameter to the query to filter the result of this lookup ?
    Thank you

    Hi,
    have a look if this helps
    http://oracle.com/technology/products/jdev/tips/fnimphius/restrictlovlist/restrictlov.html
    Frank

  • How can i pass function return values in to varray

    Hi
    create procedure name(parameters list)
    here ---i am calling a function
    varname := function name
    returns 4 values
    My doudt is how can i pass these return values in to varray..
    Type varray vname[5] date type
    Begin
    statements
    end prodedure name;
    pls clarify me its urgent

    This may give u a start
    sql>
    create or replace package test_array_pack as
    type ar1 is varray(10) of number;
    end;
    Package created.
    sql>
    create or replace function test_array return test_array_pack.ar1 is
      v_ar1 test_array_pack.ar1;
    begin
    v_ar1 := test_array_pack.ar1(1,2,3,4);
    return v_ar1;
    end;
    Function created.
    sql>
    declare
    v_ar2 test_array_pack.ar1;
    begin
    v_ar2 := test_array;
    end;
    PL/SQL procedure successfully completed
    Message was edited by:
            jeneesh                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               

  • How do I pass URL parameter after Update record?

    I have an update record page that successfully updates a record, but when it is redirected to the page it came from it loses any parameters to filter record sets to obtain the correct records.
    When I try to use the Parameters dialog box from the Update Records "select a redirect" dialog box, it results in an error indicator in front of the Update Records line in the Server Behavior, and the web page ceases to update the records.
    How do I pass a parameter to the next page?
    Thanks

    I have found a work around for this issue. By selecting the Insert or Update button and adding a hyperlink with parameter settings. The Hyperlink has the same destination as the Insert records Behavior. When the button is clicked it performs the Insert, and passes the parameters to the destination page..

  • Editable ALV: value transport before event handling

    Hi everybody,
    I'm really going crazy over this one: I'm developing an editable ALV using CL_GUI_ALV_GRID and I'm trying to check the entered data both on pressing enter and on pressing SAVE.
    Since I want to use the error log protocol I'm doing all of these check in the data_changed event handling. Now this is where it gets tricky: When a user enters a value and presses the SAVE button without pressing enter first, the following code is executed:
    CALL METHOD GOB_D1100_ALV02_GRID->CHECK_CHANGED_DATA
    So since I registered the data_changed event, will trigger the event handling BEFORE transporting the value from the GUI to the internal table. The value is only transfered after the data_changed event (where I want to make my checks because of the error protocol) is executed.
    How do I get my internal table updated before event handling?
    Best wishes,
    Ben

    YEHAW! I found a solution to my problem in this thread: editable alv: add custom validation and display "errors" in protocol list
    What you need to do is change your internal table yourself accordingly to the changes that you did on the ALV GRID.
    You can find the modified rows in table MP_MOD_ROWS of object P_ER_DATA_CHANGED.
    Then all you need to do is modify your internal table accordingly. Works like a charm (:
    FORM ALV_EVENT_DATA_CHANGED  USING P_ER_DATA_CHANGED TYPE REF TO CL_ALV_CHANGED_DATA_PROTOCOL
                                                                              P_SENDER.
      DATA: LTA_MOD_CELLS TYPE LVC_T_MODI.
      DATA: LST_MOD_CELLS TYPE LVC_S_MODI.
      FIELD-SYMBOLS: <LFS_MOD_ROWS> TYPE TABLE.
      LOOP AT P_ER_DATA_CHANGED->MT_MOD_CELLS INTO LST_MOD_CELLS.
        ASSIGN P_ER_DATA_CHANGED->MP_MOD_ROWS->* TO <LFS_MOD_ROWS>.
        READ TABLE <LFS_MOD_ROWS> ASSIGNING <FS_D1100_ALV02_DATA> INDEX LST_MOD_CELLS-TABIX.
        MODIFY GTA_D1100_ALV02_DATA FROM <FS_D1100_ALV02_DATA> INDEX LST_MOD_CELLS-ROW_ID.
      ENDLOOP.
    Thank you very much for your assitance
    Ben

  • How to get selection of a DropdownListBox and its event handler

    Hi,
    I am trying to get the selection of a DropdownListBox in its event handler. The thing is, that I can´t cast the Component to a DropdownListBox.
    DropDownListBox secondDDLB = (DropDownListBox)this.getComponentByName("SecondUserDDLB");
    How I can get the selected item in an event handler ?
    Regards
    Flo

    DropDownListBox NO
    DropdownListBox YES
    Regards

  • How to pass the parameter values to the stored procedure from java code?

    I have a stored procedure written in sqlplus as below:
    create procedure spInsertCategory (propertyid number, category varchar2, create_user varchar2, create_date date) AS BEGIN Insert into property (propertyid, category,create_user,create_date) values (propertyid , category, create_user, create_date); END spInsertCategory;
    I am trying to insert a new row into the database using the stored procedure.
    I have called the above procedure in my java code as below:
    CallableStatement sp = null;
    sp = conn.prepareCall("{call spInsertCategory(?, ?, ?, ?)}");
    How should I pass the values [propertyid, category, create_user, create_date) from java to the stored procedure?[i.e., parameters]
    Kindly guide me as I am new to java..

    Java-Queries wrote:
    I have a stored procedure written in sqlplus as below:FYI. sqlplus is a tool from Oracle that provides a user interface to the database. Although it has its own syntax what you posted is actually PL/SQL.

  • How to understand the strange parameter values shown by 'pstack core'

    I encounterred a problem that led to a core dump. I use 'pstack core' to shown the calling stack.
    However I could hardly understand some of the parameter values below:
    core 'core.150108' of 5016:     cmcfun
    ff1e1370 __1cLComEndPointFsendv6MpnFiovec_i_i_ (c, ffbfedf8, 2, 2, c, 0) + 4
    Why did the 'this' pointer of the instance of class ComEndPoint become 0xc? I don't think it is a valid value of pointer. Does anybody have any idea about this problem?
    ff1e5b00 __1cYComTransaction_Icallback6FpnPpdo_transaction_pcii_v_ (6ab90, 0, 0, 0, ffbff1b8, 0) + dc
    According to the source code, the 3rd parameter in the function below, which value is 0x66, was not changed in the scope of the function. However it became 0x0 when it was used as the 4th parameter to call the function above. What't the matter?
    ff1528e8 pdo_dispatch (6ab90, ad, 66, 0, 0, 0) + dc
    I heard that Sun C++ uses 'register windows' to pass the parameters, i0~i5 are used for the first 6 ones. Somebody told me that what I saw in the pstack might not be creditable because the registers might be changed within the function. Is that so? Would anybody plz tell me more details?
    Thanks in advance.
    Edited by: DirtyBear on Feb 15, 2008 1:17 AM

    Register windows are a property of the SPARC computer architecture, not a property of a compiler. SPARC has multiple sets of registers. The function call instruction advances the "register window" to reveal the next set of registers, if there is one. If not, the registers are spilled to the stack to free up a window. The function return instruction moves the window back. (It's a purely hardware feature.) Eight of the registers in adjacent windows overlap, the origin of the "window" term. Registers %o0 thorugh %o7 in the caller become registers %i0 through %i7 in the called function.
    On SPARC and x64, some function arguments are passed in registers, depending on how many arguments there are and their types. (The x86 architecture has no registers available for passing arguments.) On entry to a function, the parameters passed in registers might be saved on the stack, but do not necessarily need to be saved on SPARC. The Solaris ABI requires that space for the registers be allocated, but the space is not necessarily used.
    In a core dump, the actual registers, particularly for functions other than the current one, are not available. The pstack operation doesn't know how many parameters a function has or what type they are. It shows the contents of the first 6 words on the stack that would hold arguments, if there were arguments, and if they were actually saved on the stack.
    In optimized code on any platform, the stack area for a variable or argument is not kept up to date. Computations are kept in registers to the extent possible, and saved in memory only when necessary.
    On SPARC in particular, the argument values shown in a stack trace need not be accurate.

  • How can i pass the one value for two bind parameters

    hi All,
    i have a search Query
    select Distinct CONSOLIDATION_SUMMARY_ID,CREATION_DATE,CREATED_BY,BATCH_ID,PROCESS_FLAG,ERROR_MESSAGE,CUSTOMER_ID,BILLING_FREQUENCY
    ,CONSOLIDATION_LEVEL,SOLD_TO_ORG_ID ,SHIP_TO_ORG_ID ,TRANSACTIONAL_CURR_CODE ,INVOICE_TO_ORG_ID ,PRICE_LIST_ID
    ,ORIG_SYS_DOCUMENT_REF,INVENTORY_ITEM_ID ,ORGANIZATION_ID ,ORDERED_ITEM ,ORDERED_QUANTITY ,UNIT_LIST_PRICE
    ,UNIT_SEELING_PRICE,ORDER_QUANTITY_UOM,ORDER_NUMBER ,ORDER_DATE ,INVOICE_NUMBER ,INVOICE_DATE
    ,FEE_CALCULATION_WORKSHEET_PDF ,TRADE_DETAILS_PDF ,INVOICE_REPORT_PDF ,PRICING_ATTRIBUTE_CONTEXT
    ,PRICING_ATTRIBUTE ,PRICING_ATTR_VALUE_FROM
    from xxcurrnx.xxcur_trade_consol_summary XXSTR
    WHERE XXSTR.BATCH_ID=NVL(:1,XXSTR.BATCH_ID)
    and XXSTR.CUSTOMER_ID=nvl(:2,XXSTR.CUSTOMER_ID)
    But i need to pass only one value to this query: throw the below code
    public void passTocusttrxn(String vcustid)
    System.out.println("The customer id in trxn vo:"+vcustid);
    XxcurtradeconsummaryVOImpl vOrdnumb=getXxcurtradeconsummaryVO1();
    vOrdnumb.setWhereClauseParam(0,vcustid);
    vOrdnumb.setWhereClauseParam(1,null);
    vOrdnumb.executeQuery();
    System.out.println("The executed query After is :"+vOrdnumb.getQuery());
    But it throws the below exception.
    java.sql.SQLException: Missing IN or OUT parameter at index:: 1
    could you please tell me how can i achieve this.
    Thanks,

    hi Meher,
    i need to pass this value throug the Spell Parameter.
    public void processRequest(OAPageContext pageContext, OAWebBean webBean)
    super.processRequest(pageContext, webBean);
    XxcustdtlsmainAMImpl am=(XxcustdtlsmainAMImpl)pageContext.getApplicationModule(webBean);
    if(pageContext.getParameter("PCustID")!=null) // PCustID is the Spell parameter here
    if(pageContext.getParameter("PbtchID")!=null)
    if(pageContext.getParameter("PordNum")!=null)
    String vcustID=pageContext.getParameter("PCustID");
    String vOrdNum=pageContext.getParameter("PordNum");
    System.out.println("The cust id in PR:"+vcustID);
    System.out.println("The cust id in PR:"+vOrdNum);
    am.passTocustlinetrxn(vcustID);
    how this vcustID value will passed to the search Code.
    if(pageContext.getParameter("BatchID")!=null && !pageContext.getParameter("BatchID").equals(""))
    String BchID=pageContext.getParameter("BatchID");
    int vInBtchID=Integer.parseInt(BchID);
    srchVO.setWhereClauseParams(null);
    srchVO.setWhereClauseParam(0,vInBtchID);
    System.out.println("The Batch ID is :"+vInBtchID);
    f=1;
    }else
    srchVO.setWhereClauseParam(0,null);
    if(pageContext.getParameter("CustmeCode")!=null && !pageContext.getParameter("CustmeCode").equals(""))
    System.out.println("i am im customer code ");
    String vCustID=pageContext.getParameter("CustmeCode");
    srchVO.setWhereClauseParams(null);
    srchVO.setWhereClauseParam(1,vCustID);
    System.out.println("The customer code is "+vCustID);
    f=1;
    }else
    srchVO.setWhereClauseParam(1,null);
    if(f==1)
    srchVO.executeQuery();
    Regards,

  • How do I pass a null value to the reportDocument?

    I'm using CR 2008 and VS 2005. 
    I am using a stored procedure as the datasource for one of my report, which we run using the C# API.   The stored procedure is expecting a NULL in certain cases and I find I cannot pass a NULL with my current code:
    // Here I get the parameter
    // If we are dealing with an empty string or a NULL value, let's give it
                            // a value of a space so that Crystal's DLLs don't choke.
                            if ((value.Length == 0) || (value == "NULL"))
                                value = " ";
                            arrParams.Add(value);
    Object strParam = arrParams<i>;
    this.reportDocument1.SetParameterValue(num, strParam);
    The stored procedure parameter type is INT so in the report it shows up as NUMBER.
    How do I get a NULL value to the stored procedure?
    Thanks.

    See if this does the trick:
    Dim crParameterDiscreteValue As New CrystalDecisions.Shared.ParameterDiscreteValue()
    crParameterDiscreteValue.Value = Nothing
    C# would look something like;
    CrystalDecisions.Shared.ParameterDiscreteValue crParameterDiscreteValue;
    crParameterDiscreteValue = new CrystalDecisions.Shared.ParameterDiscreteValue();
    crParameterDiscreteValue.Value = null;
    Ludek
    Follow us on Twitter http://twitter.com/SAPCRNetSup

Maybe you are looking for