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.

Similar Messages

  • 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 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

  • 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

  • How to use Crystal report viewer in a portlet based web application

    I am using JRC to view crystal reports in porlet based web application. Following is the code in JSP
    <%@ page import="com.crystaldecisions.report.web.viewer.CrystalReportViewer,
    com.crystaldecisions.sdk.occa.report.application.OpenReportOptions,
    com.crystaldecisions.sdk.occa.report.application.ReportClientDocument,
    com.crystaldecisions.sdk.occa.report.lib.ReportSDKExceptionBase" %>
    <portlet:defineObjects />
    <%
         // This sample code calls methods from the CRJavaHelper class, which
         // contains examples of how to use the BusinessObjects APIs. You are free to
         // modify and distribute the source code contained in the CRJavaHelper class.
         try {
              String reportName = "ProactiveEventsSummaryData.rpt";
              ReportClientDocument clientDoc = (ReportClientDocument) session.getAttribute(reportName);
              if (clientDoc == null) {
                   // Report can be opened from the relative location specified in the CRConfig.xml, or the report location
                   // tag can be removed to open the reports as Java resources or using an absolute path
                   // (absolute path not recommended for Web applications).
                   clientDoc = new ReportClientDocument();
                   //clientDoc.setReportAppServer(ReportClientDocument.inprocConnectionString);
                                  clientDoc.setReportAppServer("inproc:jrc");
                   // Open report
                   clientDoc.open(reportName, OpenReportOptions._openAsReadOnly);
                   // Store the report document in session
                   session.setAttribute(reportName, clientDoc);
              // ****** BEGIN CONNECT CRYSTALREPORTPAGEVIEWER SNIPPET **************** 
                   // Create the CrystalReportViewer object
                   CrystalReportViewer crystalReportPageViewer = new CrystalReportViewer();
                   String reportSourceSessionKey = reportName+"ReportSource";
                   Object reportSource = session.getAttribute(reportSourceSessionKey);
                   if (reportSource == null)
                        reportSource = clientDoc.getReportSource();
                        session.setAttribute(reportSourceSessionKey, reportSource);
                   //     set the reportsource property of the viewer
                   crystalReportPageViewer.setReportSource(reportSource);
                   // Apply the viewer preference attributes
                   // Process the report
                   crystalReportPageViewer.processHttpRequest(request, response, application, null);
              // ****** END CONNECT CRYSTALREPORTPAGEVIEWER SNIPPET ****************          
         } catch (ReportSDKExceptionBase e) {
             out.println(e);
    %>
    With this code , report gets displayed in the portlet but none of the actions on thre report like next page click , search button , opening subreport , clicking on drill-downs are working . The error in the explorer console is as shown below
    Error: CrystalViewerCrystalEvent is not defined
    javascript:CrystalViewerCrystalEvent('CrystalViewer',%20'tb=next')
    PageSource of the web page shows the CrystalViewerCrystalEvent javascript function defined but for somereason its not recognized by the portlet. Has anyone worked on displaying crystalreports in a portlet ?

    Code attached
    <%@ page import="com.crystaldecisions.report.web.viewer.CrystalReportViewer,
    com.crystaldecisions.sdk.occa.report.application.OpenReportOptions,
    com.crystaldecisions.sdk.occa.report.application.ReportClientDocument,
    com.crystaldecisions.sdk.occa.report.lib.ReportSDKExceptionBase" %>
    <portlet:defineObjects />
    <%
         // This sample code calls methods from the CRJavaHelper class, which
         // contains examples of how to use the BusinessObjects APIs. You are free to
         // modify and distribute the source code contained in the CRJavaHelper class.
         try {
              String reportName = "ProactiveEventsSummaryData.rpt";
              ReportClientDocument clientDoc = (ReportClientDocument) session.getAttribute(reportName);
              if (clientDoc == null) {
                   // Report can be opened from the relative location specified in the CRConfig.xml, or the report location
                   // tag can be removed to open the reports as Java resources or using an absolute path
                   // (absolute path not recommended for Web applications).
                   clientDoc = new ReportClientDocument();
                   //clientDoc.setReportAppServer(ReportClientDocument.inprocConnectionString);
                                  clientDoc.setReportAppServer("inproc:jrc");
                   // Open report
                   clientDoc.open(reportName, OpenReportOptions._openAsReadOnly);
                   // Store the report document in session
                   session.setAttribute(reportName, clientDoc);
              // ****** BEGIN CONNECT CRYSTALREPORTPAGEVIEWER SNIPPET **************** 
                   // Create the CrystalReportViewer object
                   CrystalReportViewer crystalReportPageViewer = new CrystalReportViewer();
                   String reportSourceSessionKey = reportName+"ReportSource";
                   Object reportSource = session.getAttribute(reportSourceSessionKey);
                   if (reportSource == null)
                        reportSource = clientDoc.getReportSource();
                        session.setAttribute(reportSourceSessionKey, reportSource);
                   //     set the reportsource property of the viewer
                   crystalReportPageViewer.setReportSource(reportSource);
                   // Apply the viewer preference attributes
                   // Process the report
                   crystalReportPageViewer.processHttpRequest(request, response, application, null);
              // ****** END CONNECT CRYSTALREPORTPAGEVIEWER SNIPPET ****************          
         } catch (ReportSDKExceptionBase e) {
             out.println(e);
    %>
    Edited by: teethoma on Nov 30, 2009 10:06 AM

  • 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.

  • Error While using RequestDispatcher.forward

    Hi All,
    I am getting an error while i am forwarding a request from a controller servlet to a JSP in WAS 3.5.
    i am using the following code:
    String url = "../gede/globalservices/SCSLogin.jsp";
    RequestDispatcher rd = getServletConfig().getServletContext().getRequestDispatcher(url);
    rd.forward(request, response);
    The error i get is :
    Error 404
    An error has occured while processing request:http://teamsite-cwc-review.indsys.ge.com/cwc/servlet/com.geindsys.gede.globalservices.SCSControllerServlet
    Message: [JSP 1.0 Processor] reported an error
    i was able to get the same while using response.SendRedirect(url);
    Please help..
    Thanks in Advance..
    Regards,
    Ravi.

    Looks like your JSP is throwing an exception. Check the logs in your server to find the details about it. (Was there an XML question here? I couldn't see one.)

  • Error While using RequestDispatcher.forward --URGENT!!!

    Hi All,
    I am getting an error while i am forwarding a request from a controller servlet to a JSP in WAS 3.5.
    i am using the following code:
    String url = "../gede/globalservices/SCSLogin.jsp";
    RequestDispatcher rd = getServletConfig().getServletContext().getRequestDispatcher(url);
    rd.forward(request, response);
    The error i get is :
    Error 404
    An error has occured while processing request:http://teamsite-cwc-review.indsys.ge.com/cwc/servlet/com.geindsys.gede.globalservices.SCSControllerServlet
    Message: [JSP 1.0 Processor] reported an error
    i was able to get the same while using response.SendRedirect(url);
    Please help..
    Thanks in Advance..
    Regards,
    Ravi.

    I think the problem is in the ".." part of your url.
    If you have a webapp named cwc in the webapps/cwc directory and in this webapp in there is a file SCSLogin.jsp under webapps/cwc/gede/globalservices you should use a URL:
    String url = "/gede/globalservices/SCSLogin.jsp";

  • 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

Maybe you are looking for