How to use singloeton factory methods ?

Hi Guys,
Can any one   please help me like how to use singleton factory  methods in oops? i am very new to  OOPS concepts ?
Thanks in advance

PRINTER - part2
  METHOD constructor.
    "initial printer cartridge fill
    me->number = i_number.
    me->cartridge = i_units.
    me->cost = me->cartridge * 10.
  ENDMETHOD.                  
  METHOD increase_cost.
    cost = cost + i_units.
  ENDMETHOD.                   
  METHOD consume_cartrigde.
    cartridge = cartridge - i_units.
  ENDMETHOD.                   
  METHOD get_total_cost.
    DATA lo_printer TYPE REF TO lcl_printer.
    LOOP AT it_printers INTO lo_printer.
      r_cost = r_cost + lo_printer->get_cost( ).
    ENDLOOP.
  ENDMETHOD.                 
  METHOD get_cost.
    r_cost = cost.
  ENDMETHOD.                
  METHOD get_cartridge.
    r_cartridge = cartridge.
  ENDMETHOD.                   
  METHOD get_number.
    r_number = number.
  ENDMETHOD.                  
* helper method to show current state of printers
  METHOD show_printers.
    DATA lv_mess   TYPE string.
    DATA lv_number TYPE i.
    DATA lv_cartridge  TYPE i.
    DATA lv_cartridge_c TYPE c LENGTH 5.
    DATA lv_cost TYPE i.
    DATA lv_cost_c TYPE c LENGTH 5.
    DATA lv_number_c TYPE c LENGTH 2.
    DATA lo_printer TYPE REF TO lcl_printer.
    LOOP AT it_printers INTO lo_printer.
      lv_number_c = lv_number = lo_printer->get_number( ).
      lv_cost_c = lv_cost  = lo_printer->get_cost( ).
      lv_cartridge_c = lv_cartridge = lo_printer->get_cartridge( ).
      CONCATENATE lv_mess 'Printer:' lv_number_c ', cost:' lv_cost_c ', cartridge:' lv_cartridge_c
                  cl_abap_char_utilities=>cr_lf INTO lv_mess SEPARATED BY space.
    ENDLOOP.
    MESSAGE lv_mess TYPE 'I'.
  ENDMETHOD.                   
ENDCLASS.  
CLIENT
DATA go_printer  TYPE REF TO lcl_printer. "printers
DATA go_job TYPE REF TO lcl_job.          "job
DATA  gv_mess TYPE string.
DATA: gv_number TYPE i,
      gv_number_c TYPE c LENGTH 10.
SELECTION-SCREEN BEGIN OF BLOCK bl1 WITH FRAME.
PARAMETERS: pa_print  TYPE i OBLIGATORY, "printer number
            pa_units TYPE i DEFAULT 100. "initial printer filling
SELECTION-SCREEN PUSHBUTTON /10(15) addp  USER-COMMAND fcadd  VISIBLE LENGTH 15.
SELECTION-SCREEN PUSHBUTTON /10(15) refil USER-COMMAND fcref  VISIBLE LENGTH 15.
SELECTION-SCREEN PUSHBUTTON /10(15) show  USER-COMMAND fcshow VISIBLE LENGTH 15.
SELECTION-SCREEN PUSHBUTTON /10(15) print USER-COMMAND fcprnt VISIBLE LENGTH 15.
SELECTION-SCREEN PUSHBUTTON /10(15) total USER-COMMAND fctot  VISIBLE LENGTH 15.
SELECTION-SCREEN END OF BLOCK bl1.
SELECTION-SCREEN BEGIN OF BLOCK bl2 WITH FRAME.
PARAMETERS: pa_col   TYPE c1,
            pa_pages TYPE i,
            pa_numb  TYPE i. "to which printer you want the job be send to
SELECTION-SCREEN END OF BLOCK bl2.
INITIALIZATION.
  addp = 'Add printer'.
  show = 'Show printers'.
  print = 'Print'.
  total = 'Total cost'.
  refil = 'Refill'.
AT SELECTION-SCREEN.
  CLEAR: gv_number, gv_number_c, gv_mess.
  CASE sy-ucomm.
    WHEN 'FCADD'.
      go_printer = lcl_printer=>factory( i_number = pa_print
                                         i_units  = pa_units ).
    WHEN 'FCSHOW'.
      IF go_printer IS NOT BOUND.
        MESSAGE 'Add at least one printer first' TYPE 'E'.
      ELSE.
        go_printer->show_printers( ).
      ENDIF.
    WHEN 'FCPRNT'.
      IF pa_pages IS INITIAL.
        MESSAGE 'Provide number of pages' TYPE 'E'.
      ENDIF.
      CREATE OBJECT go_job EXPORTING i_pages = pa_pages i_color = pa_col.
      IF lcl_printer=>get_printer( pa_numb ) IS NOT BOUND.
        gv_number_c = pa_numb.
        condense gv_number_c.
        CONCATENATE 'Printer' gv_number_c 'doesn`t exist, select correct one' INTO gv_mess SEPARATED BY space.
        MESSAGE gv_mess TYPE 'E'.
      ELSE.
        go_printer->print( i_number = pa_numb
                           io_job   = go_job ).
      ENDIF.
    WHEN 'FCTOT'.
      IF go_printer IS BOUND.
        gv_number_c = gv_number = go_printer->get_total_cost( ).
      ENDIF.
      CONCATENATE 'Total cost of all printers for printing and initial cartridge filling is: ' gv_number_c INTO gv_mess
                  SEPARATED BY space.
      MESSAGE gv_mess TYPE 'I'.
    WHEN 'FCREF'.
      IF lcl_printer=>get_printer( pa_print ) IS NOT BOUND.
        gv_number_c = pa_print.
        CONCATENATE 'Printer doesn`t exist' gv_number_c INTO gv_mess SEPARATED BY space.
        MESSAGE gv_mess TYPE 'E'.
      ELSE.
        go_printer->fill_cartridge( i_number = pa_print
                                    i_units = pa_units ).
      ENDIF.
  ENDCASE.
Regards
Marcin

Similar Messages

  • Multiple ALV display using SALV(Factory method)...

    Hello Experts,
    Please provide me any examples on how to display multiple ALV
    displays in a screen using SALV(Factory method).
    Hope you can help me guys.
    Thank you and take care!

    Hi Viraylab,
    Kindly check the program below, this will help you..
    *& Report  Z101754_REPORT
    REPORT  z101754_report.
    TABLES: zvbak_101754,zvbap_101754,mara.
    TYPE-POOLS: slis.
    DATA : i_fieldcat TYPE slis_t_fieldcat_alv.
    DATA: FLDNAME(24).
    DATA : BEGIN OF itab_zvbap OCCURS 0,
           zvbeln LIKE zvbap_101754-zvbeln,
      zposnr LIKE zvbap_101754-zposnr,
      zmatnr LIKE zvbap_101754-zmatnr,
      zbrgew LIKE zvbap_101754-zbrgew,
      zgi_qty LIKE zvbap_101754-zgi_qty,
      zinv_qty LIKE zvbap_101754-zinv_qty,
           END OF itab_zvbap.
    SELECTION-SCREEN BEGIN OF BLOCK block1 WITH FRAME TITLE text-t01.
    SELECT-OPTIONS : s_zvbeln FOR zvbak_101754-zvbeln,
                     s_zkunwe FOR zvbak_101754-zkunwe,
                     s_zerdat FOR zvbak_101754-zerdat,
                     s_zmatnr FOR zvbap_101754-zmatnr.
    SELECTION-SCREEN END OF BLOCK block1.
    SELECTION-SCREEN: BEGIN OF BLOCK block2 WITH FRAME TITLE t02.
    PARAMETERS     : invoiced AS CHECKBOX,
                     s_gi AS CHECKBOX .
    SELECTION-SCREEN: END OF BLOCK block2.
    SELECTION-SCREEN: BEGIN OF BLOCK block3 WITH FRAME TITLE t03.
    PARAMETERS     : alv_list RADIOBUTTON GROUP g1,
                     alv_grid RADIOBUTTON GROUP g1,
                     s_class RADIOBUTTON GROUP g1.
    SELECTION-SCREEN: END OF BLOCK block3.
    Screen Field Validation event
    AT SELECTION-SCREEN ON s_zvbeln.
      SELECT SINGLE *
       FROM zvbak_101754 WHERE zvbeln IN s_zvbeln.
      IF sy-subrc NE 0.
        MESSAGE e000(z754).
      ENDIF.
    AT SELECTION-SCREEN ON s_zkunwe.
      SELECT SINGLE *
       FROM zvbak_101754 WHERE zkunwe IN s_zkunwe.
      IF sy-subrc NE 0.
        MESSAGE e001(z754).
      ENDIF.
    AT SELECTION-SCREEN ON s_zerdat.
      SELECT SINGLE *
         FROM zvbak_101754 WHERE zerdat IN s_zerdat.
      IF sy-subrc NE 0.
        MESSAGE e002(z754).
      ENDIF.
    AT SELECTION-SCREEN ON s_zmatnr.
      SELECT SINGLE *
       FROM zvbap_101754    WHERE zmatnr IN s_zmatnr.
      IF sy-subrc NE 0.
        MESSAGE e003(z754).
      ENDIF.
    Start-Of-Selection Event
    START-OF-SELECTION.
      PERFORM select-data.
    End-Of-Selection Event
    END-OF-SELECTION.
      PERFORM display.
    *&      Form  select-data
          text
    -->  p1        text
    <--  p2        text
    FORM select-data .
      SELECT zvbeln zposnr zmatnr zbrgew zgi_qty zinv_qty
         INTO CORRESPONDING  FIELDS OF TABLE itab_zvbap
         FROM zvbap_101754
         WHERE  zvbeln IN s_zvbeln.
    ENDFORM.                    " select-data3
    TOP-OF-PAGE.
    AT LINE-SELECTION.
    FORMAT HOTSPOT.
    *GET THE FIELD NAME ON LINE SELECTION
      GET CURSOR FIELD FLDNAME .  "value field_value.
      IF FLDNAME = 'itab_zvbap-zvbeln'.
      SET PARAMETER ID 'BES' FIELD itab_zvbap-zvbeln.
      CALL TRANSACTION 'ZVA01_101754'.
      ENDIF.
    *&      Form  DISPLAY
          text
    -->  p1        text
    <--  p2        text
    FORM display .
      IF s_class ='X'.
        PERFORM display_header.
        LOOP AT itab_zvbap.
          WRITE : / sy-vline,
                  itab_zvbap-zvbeln ,
                  13 sy-vline,
                  itab_zvbap-zposnr ,
                  30 sy-vline,
                  itab_zvbap-zmatnr ,
                  45 sy-vline,
                  itab_zvbap-zbrgew UNIT mara-meins ,
                  65 sy-vline,
                  itab_zvbap-zgi_qty UNIT mara-meins,
                  85 sy-vline,
                  itab_zvbap-zinv_qty UNIT mara-meins,
                  105 sy-vline,
                  / sy-uline(105).
        ENDLOOP.
      ENDIF.
    *&     Creating the fieldcatalog.
      CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'
       EXPORTING
         i_program_name               = sy-repid
         i_internal_tabname           = 'ITAB_ZVBAP'
      I_STRUCTURE_NAME             =
      I_CLIENT_NEVER_DISPLAY       = 'X'
         i_inclname                   = sy-repid
      I_BYPASSING_BUFFER           =
      I_BUFFER_ACTIVE              =
        CHANGING
          ct_fieldcat                  = i_fieldcat
    EXCEPTIONS
    inconsistent_interface       = 1
    program_error                = 2
    OTHERS                       = 3
      IF sy-subrc <> 0.
        MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
               WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
      ENDIF.
      IF alv_list = 'X'.
        CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
         EXPORTING
      I_INTERFACE_CHECK              = ' '
      I_BYPASSING_BUFFER             =
      I_BUFFER_ACTIVE                = ' '
           i_callback_program             = sy-repid
           i_callback_pf_status_set       = ' '
           i_callback_user_command        = 'USER_COMMAND '
      I_STRUCTURE_NAME               =
      IS_LAYOUT                      =
           it_fieldcat                    = i_fieldcat
      IT_EXCLUDING                   =
      IT_SPECIAL_GROUPS              =
      IT_SORT                        =
      IT_FILTER                      =
      IS_SEL_HIDE                    =
      I_DEFAULT                      = 'X'
      I_SAVE                         = ' '
      IS_VARIANT                     =
      IT_EVENTS                      =
      IT_EVENT_EXIT                  =
      IS_PRINT                       =
      IS_REPREP_ID                   =
      I_SCREEN_START_COLUMN          = 0
      I_SCREEN_START_LINE            = 0
      I_SCREEN_END_COLUMN            = 0
      I_SCREEN_END_LINE              = 0
      IR_SALV_LIST_ADAPTER           =
      IT_EXCEPT_QINFO                =
      I_SUPPRESS_EMPTY_DATA          = ABAP_FALSE
    IMPORTING
      E_EXIT_CAUSED_BY_CALLER        =
      ES_EXIT_CAUSED_BY_USER         =
          TABLES
            t_outtab                       = itab_zvbap[]
    EXCEPTIONS
       program_error                  = 1
       OTHERS                         = 2
        IF sy-subrc <> 0.
          MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
                  WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
        ENDIF.
      ENDIF.
      IF alv_grid = 'X'.
        CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
    EXPORTING
      I_INTERFACE_CHECK                 = ' '
      I_BYPASSING_BUFFER                = ' '
      I_BUFFER_ACTIVE                   = ' '
           i_callback_program                = sy-repid
        i_callback_pf_status_set          = ' '
        i_callback_user_command           = 'USER_COMMAND '
      I_CALLBACK_TOP_OF_PAGE            = ' '
      I_CALLBACK_HTML_TOP_OF_PAGE       = ' '
      I_CALLBACK_HTML_END_OF_LIST       = ' '
      I_STRUCTURE_NAME                  =
      I_BACKGROUND_ID                   = ' '
      I_GRID_TITLE                      =
      I_GRID_SETTINGS                   =
      IS_LAYOUT                         =
        it_fieldcat                       =  i_fieldcat
      IT_EXCLUDING                      =
      IT_SPECIAL_GROUPS                 =
      IT_SORT                           =
      IT_FILTER                         =
      IS_SEL_HIDE                       =
      I_DEFAULT                         = 'X'
      I_SAVE                            = ' '
      IS_VARIANT                        =
      IT_EVENTS                         =
      IT_EVENT_EXIT                     =
      IS_PRINT                          =
      IS_REPREP_ID                      =
      I_SCREEN_START_COLUMN             = 0
      I_SCREEN_START_LINE               = 0
      I_SCREEN_END_COLUMN               = 0
      I_SCREEN_END_LINE                 = 0
      I_HTML_HEIGHT_TOP                 = 0
      I_HTML_HEIGHT_END                 = 0
      IT_ALV_GRAPHICS                   =
      IT_HYPERLINK                      =
      IT_ADD_FIELDCAT                   =
      IT_EXCEPT_QINFO                   =
      IR_SALV_FULLSCREEN_ADAPTER        =
    IMPORTING
      E_EXIT_CAUSED_BY_CALLER           =
      ES_EXIT_CAUSED_BY_USER            =
       TABLES
         t_outtab                          = itab_zvbap[]
    EXCEPTIONS
       program_error                     = 1
       OTHERS                            = 2
        IF sy-subrc <> 0.
          MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
                  WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
        ENDIF.
      ENDIF.
    ENDFORM.                    " DISPLAY
    *&      Form  display_header
          text
    -->  p1        text
    <--  p2        text
    FORM display_header .
      WRITE : / sy-vline,
                  'ORDER NO',
                  13 sy-vline,
                   'ITEM NO',
                  30 sy-vline,
                   'MATERIAL NO',
                  45 sy-vline,
                   'ORDER QTY',
                  65 sy-vline,
                   'GI QTY',
                  85 sy-vline,
                  'INVOICED QTY',
                  105 sy-vline,
                  / sy-uline(105).
    ENDFORM.                    " display_header
    Please let me know if you have any doubt.
    Regards,
    Amit.

  • How to use the index method for pathpoints object in illustrator through javascripts

    hii...
    am using Illustrator CS2 using javascripts...
    how to use the index method for pathpoints object in illustrator through javascripts..

    Hi, what are you trying to do with path points?
    CarlosCanto

  • How to use the POST method In Oracle APEX 3.1

    Hi,
    In APEX if we are submitting the page the parameters( Variables ) will pass through URL.
    How to hide the these parameters from URL??
    I Hope POST method will solve this problem.
    How to use the POST method in APEX???
    Help me out to solve this problem.
    thanks in advance.
    Cheers,
    Shan

    In APEX if we are submitting the page the parameters( Variables ) will pass through URL.No they won't. Submission POSTs the <tt>wwv_flow</tt> form.
    Sometimes a branch may be performed after submission, generating a URL in which parameter values are visible. To avoid this, use the save state before branching option.
    Other actions&mdash;like using navigation lists, or clicking a link in a report&mdash;will perform a GET using parameters in the URL. In these cases using Session State Protection is advised.

  • How to use my findTheHighest method to find the highest value in my two dim

    I am going to create a 13row by 10 colume two dimensional array.
    how to use my findTheHighest method to find the highest value in my two dimensional array.
    .When i compile this program , i got those as following;
    "Exception in thread "main" java.lang.ArrayIndexOutOfBoundsExce
    at TaxEvolution.findTheHighest(TaxEvolution.java:31)
    at TaxEvolutionClient.main(TaxEvolutionClient.java:25)"
    public class TaxEvolution{
    public double[][] salesTaxRates;
    public TaxEvolution()
      salesTaxRates = new double[13][10];
      fillProvinTaxRates();
    private void fillProvinTaxRates()
      for ( int row = 0; row < salesTaxRates.length; row++ )
        for ( int column = 0; column < salesTaxRates[row].length; column++ )
          salesTaxRates[row][column]= (int)(Math.random()*5000) + 1;
    public double findTheHighest()
        double highest = salesTaxRates[0][0];
        for ( int row = 0; row <= salesTaxRates.length; row++ )
          for ( int column = 0; column <= salesTaxRates[row].length; column++ )
             if ( salesTaxRates[row][column] >= highest )
                   highest = salesTaxRates[row][column];
        return highest;   
    public double[][] arrayTaxEvolution()
      double[][] returnTaxRates = new double[13][10];
      for ( int row = 0; row < salesTaxRates.length; row++ )
        for ( int column = 0; column < salesTaxRates[row].length; column++ )
          returnTaxRates = salesTaxRates;
      return returnTaxRates;
    public class TaxEvolutionClient{
    public static void main( String[] args ){
      TaxEvolution protaxRateList = new TaxEvolution();
      double[][] taxRateList = protaxRateList.arrayTaxEvolution();
        for ( int i = 0; i < taxRateList.length; i++ )
          for ( int j = 0; j < taxRateList[0].length; j++ )
            System.out.print( taxRateList[i][j] + "\t" );               
            System.out.print( protaxRateList.findTheHighest + "\t" );
    }

    Multiposted
    http://forum.java.sun.com/thread.jspa?threadID=699057&tstart=0

  • How to use super.finalize method?

    Hi,
    pls guide how to use super.finalise ( ) method ?
    Regards,
    Pavani

    http://www.janeg.ca/scjp/gc/finalize.html
    Armin

  • How to use ApplicationModule custom methods in JSP?

    I have an ApplicationModule for which I have defined several custom methods (in the ApplicationModuleImpl class). I wish to invoke these methods from a JSP. I'm having trouble getting a scriptable reference to the application module object in the JSP. I can get data from the view objects using the jbo:xxx data tags, but I can't get any sort of reference to the application module object that would allow me to invoke the methods. I have tried editing the application module to expose the methods as client methods, but still can't get a reference to them.
    My main questions:
    1. Is there a way to invoke the custom methods somewhere between the jbo:ApplicationModule tag and the jbo:ReleasePageResources tag?
    2. Is there a way to declare and use the application module without using the jbo:ApplicationModule tag? Would I ever benefit from doing this?

    Alan, here's how to call a custom method String getSomeInfo() that I've created on my application module, MyModule in this example. Also, in this example the id parameter in the ApplicationModule tag is "am" (<jbo:ApplicationModule id="am"...):
    First, edit your application module. In the app module editor, go to the Client Methods tab and move getSomeInfo into the selected list.
    Next, edit your JSP to call your custom method.
    <% MyModule myAm = (MyModule)am.useApplicationModule(); String someInfo = myAm.getSomeInfo(); %>
    You also have to add the correct import statements to the page tag in your JSP:
    <%@ page contentType="text/html;charset=windows-1252" import="oracle.jbo.*, MyModule.common.*"%>
    Hope this helps
    Blaise

  • How to use the is_selected method of if_wd_context_element API

    HI,
    scenario : if the element is selected, I want to pass some of its attributes to the backend.
    description : In a Context node, I want to check which elements are selected by the user. For this there is a method in the in if_wd_context_elemenent API in web dynpro ABAP. The method is called is_selected. How to use this method ?
    Please give me an example. What does this method return. can I use it in the if condition.
    Regards
    seventyros
    Edited by: seventyros on May 5, 2011 9:32 AM

    Hi tryos,
    IS_SELECT method is available at element and node level.
    check this...
    http://help.sap.com/saphelp_nw04s/helpdata/en/fd/be5b4150b38147e10000000a1550b0/content.htm
    Check this is set_selected method, try with is_select also...
    Select All in table
    if lo_el_it_lips->is_selected ( flag = abap_true ).
    endif.
    // Node
    DO count TIMES.
    lo_nd_it_lips1->is_selected(             // lo_el_it_lips - element has no index, only flag.
    flag = abap_true
    index = int ).
    ADD 1 TO int.
    ENDDO.
    Cheers,
    Kris.
    Edited by: kissnas on May 5, 2011 9:49 AM

  • How i use bapi as method?

    hi friends.....
    i have BAPI........i want use that BAPI as METHOD for creating task or
    how i use this that BAPI in my workflow template.
    Thanks in advance,
    bhaskar

    You have to create a method on a business object, althoug in most cases this already exists in SAP,
    so first check in SWO1 for the business object if this is already done.
    If not, use, for instance  method change of business object BUS2012 as a reference (go to swo1, type in bus2012, click display, position the cursor on the method change and click button program)
    Kind regards, Rob Dielemans

  • How to use Ajax Web method in v4.master page to pass value to server side from JavaScript?

    Hi,
    I am customizing my v4.master page. Just adding jquery "Multiselect" dropdown .
    I want to pass selected value to code behind to perform some database activities.
    Here no code behind for me. Just i have added "Server side script" as a code behind.
    How to pass the value?
    Anyone give me the idea on it.
    Thanks & Regards
    Poomani Sankaran

    try using asp.net variables as per below links:
    http://sharepoint.stackexchange.com/questions/88777/how-to-use-a-variable-in-the-masterpage
    http://sharepoint.stackexchange.com/questions/80074/how-can-i-use-the-current-language-as-a-variable-in-my-masterpage
    https://msdn.microsoft.com/en-us/library/ms476046%28v=office.12%29.aspx
    http://www.dotnetfunda.com/articles/show/1507/how-to-access-master-page-variableproperty-from-the-content-page
    Please mark answer as correct if it is correct else vote for it if you find it useful Happy SharePointing

  • HT1695 How can use my factory unlocked iphone better ?

    i want to know more about how to use siri?
    Is data necessary for siri?
    guide me well!

    http://www.imore.com/siri-ultimate-guide
    http://www.apple.com/iphone/features/siri-faq.html

  • How to use RequestDispatcher.forward method  in a portlet

    I have a servlet (HelloServlet2) that acts as the controller. This is a very simplified example. This servlet calls the dispatcher.foward(req, res) method to foward to a JSP page for displaying. At this point I get a FileNotFoundException. The HelloServlet2 is in the standard location WEB-INF/classes/com/a2i/industrial/servlet/HelloServlet2.java.
    How come it's looking in Industrial/servlet/HelloServlet2 instead of Industrial/WEB-INF/classes/..? If I access the servlet by http://host:port/Industrial/HelloServlet2, it works fine. I have another portlet (servlet) that doesn't call the forward method and it works fine too. Thanks for your help.
    Here is the web.xml:
    <servlet>
    <servlet-name>HelloServlet2</servlet-name>
    <display-name>HelloServlet2</display-name>
    <servlet-class>com.a2i.industrial.servlet.HelloServlet2</servlet-class>
    </servlet>
    <servlet-mapping>
    <servlet-name>HelloServlet2</servlet-name>
    <url-pattern>/HelloServlet2/*</url-pattern>
    </servlet-mapping>
    Here is the calling code from HelloServlet2:
    public void doGet(HttpServletRequest req, HttpServletResponse res)
    throws ServletException, IOException
    RequestDispatcher dispatcher= getServletContext().getRequestDispatcher("/hello.jsp");
    dispatcher.forward(req, res);
    Here is the portlet definition:
    <portlet class="oracle.portal.provider.v2.DefaultPortletDefinition">
    <id>2</id>
    <name>HelloServlet2</name>
    <title>Hello Servlet2</title>
    <shortTitle>Hello Servlet2</shortTitle>
    <description>This is the "hello world" sample implemented using Java Servlets and the extensible renderer architecture.</description>
    <timeout>10000</timeout>
    <timeoutMessage>Hello Servlet timed out</timeoutMessage>
    <acceptContentType>text/html</acceptContentType>
    <renderer class="oracle.portal.provider.v2.render.RenderManager">
    <contentType>text/html</contentType>
    <autoRedirect>true</autoRedirect>
    <showPage>/servlet/HelloServlet2</showPage>
    </renderer>
    </portlet>
    Here is the stack trace:
    7/15/03 10:43 AM industrial: JspServlet: unable to dispatch to requested page: java.io.FileNotFoundException: C:\ora9iasp\j2ee\OC4J_Portal\applications\_industrial\industrial\servlet\HelloServlet2 (The system cannot find the path specified)
         at java.io.FileInputStream.open(Native Method)
         at java.io.FileInputStream.<init>(FileInputStream.java:64)
         at oracle.jsp.provider.JspFilesystemResource.fromStream(JspFilesystemResource.java:153)
         at oracle.jsp.provider.JspFilesystemResource.fromReader(JspFilesystemResource.java:169)
         at oracle.jsp.runtimev2.JspPageCompiler.fromReader(JspPageCompiler.java:345)
         at oracle.jsp.runtimev2.JspPageCompiler.attemptCompilePage(JspPageCompiler.java:250)
         at oracle.jsp.runtimev2.JspPageCompiler.compilePage(JspPageCompiler.java:171)
         at oracle.jsp.runtimev2.JspPageInfo.compileAndLoad(JspPageInfo.java:338)
         at oracle.jsp.runtimev2.JspPageTable.compileAndServe(JspPageTable.java:481)
         at oracle.jsp.runtimev2.JspPageTable.service(JspPageTable.java:255)
         at oracle.jsp.runtimev2.JspServlet.internalService(JspServlet.java:407)
         at oracle.jsp.runtimev2.JspServlet.service(JspServlet.java:330)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:336)
         at com.evermind.server.http.ResourceFilterChain.doFilter(ResourceFilterChain.java:59)
         at oracle.security.jazn.oc4j.JAZNFilter.doFilter(JAZNFilter.java:283)
         at com.evermind.server.http.ServletRequestDispatcher.invoke(ServletRequestDispatcher.java:523)
         at com.evermind.server.http.ServletRequestDispatcher.forwardInternal(ServletRequestDispatcher.java:269)
         at com.evermind.server.http.ServletRequestDispatcher.forward(ServletRequestDispatcher.java:219)
         at com.a2i.industrial.servlet.HelloServlet2.doGet(HelloServlet2.java:21)
         at com.a2i.industrial.servlet.HelloServlet2.doPost(HelloServlet2.java:14)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:283)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:336)
         at com.evermind.server.http.ResourceFilterChain.doFilter(ResourceFilterChain.java:59)
         at oracle.security.jazn.oc4j.JAZNFilter.doFilter(JAZNFilter.java:283)
         at com.evermind.server.http.ServletRequestDispatcher.invoke(ServletRequestDispatcher.java:523)
         at com.evermind.server.http.ServletRequestDispatcher.include(ServletRequestDispatcher.java:108)
         at oracle.portal.provider.v2.render.http.ResourceRenderer.renderBody(Unknown Source)
         at oracle.portal.provider.v2.render.RenderManager.render(Unknown Source)
         at oracle.portal.provider.v2.DefaultPortletInstance.render(Unknown Source)
         at oracle.webdb.provider.v2.adapter.soapV1.ProviderAdapter.showPortlet(Unknown Source)
         at oracle.webdb.provider.v2.adapter.soapV1.ProviderAdapter.handleHttp(Unknown Source)
         at java.lang.reflect.Method.invoke(Native Method)
         at oracle.webdb.provider.v2.adapter.SOAPServlet.doHTTPCall(Unknown Source)
         at oracle.webdb.provider.v2.adapter.SOAPServlet.service(Unknown Source)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:336)
         at com.evermind.server.http.ResourceFilterChain.doFilter(ResourceFilterChain.java:59)
         at oracle.security.jazn.oc4j.JAZNFilter.doFilter(JAZNFilter.java:283)
         at com.evermind.server.http.ServletRequestDispatcher.invoke(ServletRequestDispatcher.java:523)
         at com.evermind.server.http.ServletRequestDispatcher.forwardInternal(ServletRequestDispatcher.java:269)
         at com.evermind.server.http.HttpRequestHandler.processRequest(HttpRequestHandler.java:735)
         at com.evermind.server.http.AJPRequestHandler.run(AJPRequestHandler.java:151)
         at com.evermind.util.ThreadPoolThread.run(ThreadPoolThread.java:64)
    7/15/03 10:43 AM industrial: ERROR: ResourceRenderer.renderBody - Resource "/servlet/HelloServlet2" returned HTTP Status: 404. Error message: OracleJSP:
    java.io.FileNotFoundException: C:\ora9iasp\j2ee\OC4J_Portal\applications\_industrial\industrial\servlet\HelloServlet2 (The system cannot find the path specified). Content returned follows....

    Thanks for you help David. I changed my code from getServletContext().getRequestDispatcher(jspPage).forward(req, res) to getServletContext().getNamedDispatcher(jspPage).forward(req, res). It worked but I run into the same problem with jsp:include.
    I am using the July 2003 of the PDK. I followed the direction for installing version 2 but I did not redeploy with the new jpdk.ear since one was already deployed. After redeploying with the new jpdk.ear, it fixed the jsp:include problem I was having. The problem with using getServletContext().getRequestDispatcher(jspPage).forward(req, res) STILL exist. I am not sure what the deal is.
    Oh, I also tried the code below and it doesn't work.
    path = req.getContextPath() + jspPage
    getServletContext().getRequestDispatcher(path).forward(req, res)
    In any case, using getNamedDispatcher() is working fine. I am still curious about getRequestDispatcher() though.

  • How to use multi async method in Windows Runtime Component (C#)

    I want to migrate an async method into Windows Runtime Component.
    CookieContainer cc = await utility.GetCookieContainer();
    But the content of async method still contains async methods.
    public async Task<CookieContainer> GetCookieContainer()
    if (stsAuthToken != null)
    if (DateTime.Now > stsAuthToken.Expires)
    this.stsAuthToken = await GetMsoStsSAMLToken();
    AuthCookies cookies = await GetAuthCookies(this.stsAuthToken);
    CookieContainer cc = new CookieContainer();
    Cookie samlAuthCookie = new Cookie("FedAuth", cookies.FedAuth)
    Path = "/",
    Expires = this.stsAuthToken.Expires,
    Secure = cookies.Host.Scheme.Equals("https"),
    HttpOnly = true,
    Domain = cookies.Host.Host
    cc.Add(this.spSiteUrl, samlAuthCookie);
    Cookie rtFACookie = new Cookie("rtFA", cookies.RtFA)
    Path = "/",
    Expires = this.stsAuthToken.Expires,
    Secure = cookies.Host.Scheme.Equals("https"),
    HttpOnly = true,
    Domain = cookies.Host.Host
    cc.Add(this.spSiteUrl, rtFACookie);
    this.cookieContainer = cc;
    And even GetMsoStsSAMLToken and GetAuthCookies contain async methods...
    How to migrate it?

    Hi Matt,
    I'm sorry for my unclear description.
    My WinRT Component is for Javascript. If I use folloiong codes, error occurs.
    public static async Task<bool> GetInternal(string url, string username, string password)
    bool r = await AuthUtility.Create(new Uri(url), username, password);
    return r;
    The error is
    SharePointWindowsRuntimeComponent.Common.GetInternal(System.String, System.String, System.String)' has a parameter of type 'System.Threading.Tasks.Task<System.Boolean>' in its signature. Although this generic type is not a valid Windows Runtime type,
    the type or its generic parameters implement interfaces that are valid Windows Runtime types.  Consider changing the type 'Task' in the method signature to one of the following types instead: Windows.Foundation.IAsyncAction, Windows.Foundation.IAsyncOperation,
    or one of the other Windows Runtime async interfaces. The standard .NET awaiter pattern also applies when consuming Windows Runtime async interfaces. Please see System.Runtime.InteropServices.WindowsRuntime.AsyncInfo for more information about converting managed
    task objects to Windows Runtime async interfaces.
    Some articles said, Task<T> is not WinRT type and should be converted to IAsyncOperation<T>. Only stirng, int, bool, object, array of above types and some 'simple' type can be used. (The
    related article)
    Then I try to convert Task<bool>, but the codes don't work.
    Above is why I ask this question.
    If async method can be used in WinRT component directly, please let me know why I got above error.
    Thanks.

  • How to use the readLine()  method when reading data from a URL?

    Hello,
    I have a URL which contains text input.
    The only way to get the data from this URL is by opening a URL connection to it.
    I would like to get the data from this URL but at the same time I would like to be able to use readLine() method of BufferedReader in order to read the data line by line.
    My question is how do I combine between these two requirements in order to reed the data from the URL?
    Roy

    Hello Roy,
    can you try out this code.
      URL yahoo = new URL("http://www.yahoo.com/");
            URLConnection yc = yahoo.openConnection();
            BufferedReader in = new BufferedReader(
                                    new InputStreamReader(
                                    yc.getInputStream()));
            String inputLine;
            while ((inputLine = in.readLine()) != null)
                System.out.println(inputLine);
            in.close();
    Regards,
    Mohan R

  • Multiple ALV display in one screen using SALV(Factory method)...

    Hello Experts,
    I tried using the old 'REUSE_ALV_BLOCK_LIST_APPEND' but it does not suit my
    requirement. So will it be possible to display multiple ALV display(block) using
    SALV?

    check the sample code..
    REPORT  zsalv_demo_multiple.
    DATA: salv1 TYPE REF TO cl_salv_table,
          salv2 TYPE REF TO cl_salv_table,
          salv3 TYPE REF TO cl_salv_table.
    DATA: g_custom TYPE REF TO cl_gui_custom_container,
    o_splitter    TYPE REF TO cl_gui_splitter_container,
    o_grid1 TYPE REF TO cl_gui_container,
    o_grid2  TYPE REF TO cl_gui_container,
    o_grid3  TYPE REF TO cl_gui_container.
    DATA: it_flight TYPE STANDARD TABLE OF sflight,
          it_carr  TYPE TABLE OF scarr,
          it_book TYPE TABLE OF sbook.
    START-OF-SELECTION.
      SELECT * FROM sflight
      INTO TABLE it_flight
      UP TO 20 ROWS.
      SELECT * FROM scarr
      INTO TABLE it_carr
      UP TO 20 ROWS.
      SELECT * FROM sbook
      INTO TABLE it_book
      UP TO 20 ROWS.
      CALL SCREEN 100.
    *&      Module  STATUS_0100  OUTPUT
    *       text
    MODULE status_0100 OUTPUT.
      SET PF-STATUS 'ABC'.
      CREATE OBJECT g_custom
      EXPORTING container_name = 'CONT'.
      CREATE OBJECT o_splitter
      EXPORTING parent  = g_custom
      rows    = 3
      columns = 1.
      CALL METHOD o_splitter->get_container
        EXPORTING
          row       = 1
          column    = 1
        RECEIVING
          container = o_grid1.
      CALL METHOD o_splitter->get_container
        EXPORTING
          row       = 2
          column    = 1
        RECEIVING
          container = o_grid2.
      CALL METHOD o_splitter->get_container
        EXPORTING
          row       = 3
          column    = 1
        RECEIVING
          container = o_grid3.
      cl_salv_table=>factory(
        EXPORTING
          r_container    = o_grid1
        IMPORTING
          r_salv_table   = salv1
        CHANGING
          t_table        = it_flight
      cl_salv_table=>factory(
        EXPORTING
          r_container    = o_grid2
        IMPORTING
          r_salv_table   = salv2
        CHANGING
          t_table        = it_carr
      cl_salv_table=>factory(
        EXPORTING
          r_container    = o_grid3
        IMPORTING
          r_salv_table   = salv3
        CHANGING
          t_table        = it_book
      CALL METHOD salv1->display.
      CALL METHOD salv2->display.
      CALL METHOD salv3->display.
    ENDMODULE.                 " STATUS_0100  OUTPUT
    *&      Module  USER_COMMAND_0100  INPUT
    *       text
    MODULE user_command_0100 INPUT.
      CASE sy-ucomm.
        WHEN 'BACK'.
          LEAVE TO SCREEN 0.
      ENDCASE.
    ENDMODULE.                 " USER_COMMAND_0100  INPUT
    Flow Logic..
    PROCESS BEFORE OUTPUT.
    MODULE STATUS_0100.
    PROCESS AFTER INPUT.
    MODULE USER_COMMAND_0100.
    in the Screen i placed a custom control and named it as CONT

Maybe you are looking for