Servlet to pass parameter to another servlet

Hi, I have a question. I have two servlets, servler A and servlet B. I wanna do this:
1)servlet A to pass a parameter to servlet B. No redirect is required.
2)servlet B to accept the parameter.
How do I do that?
Thanks

1)servlet A to pass a parameter to servlet B. No redirect is required.
2)servlet B to accept the parameter.I completely agree with what capitao suggested.
As U said tht u need not require a redirect functionality
U actually need to implement a proxy kind of mechanism in this case
You may also go by using HttpURLConnection Object to retrive the info by passing few parameters.
checkout an eq code down below
HttpURLConnection server = (HttpURLConnection)(new URL("http://<hostname>:<port>/servletC")).openConnection();
server.setRequestProperty("testParam","testParam");
InputStreamReader isr = new InputStreamReader( server.getInputStream() );
BufferedReader in = new BufferedReader( isr );
response.setContentType( "text/html" );
PrintWriter outStr = response.getWriter();
String line = "";
while((line = in.readLine()) != null) {
outStr.println( line );
}

Similar Messages

  • Pass parameter to another block

    I try to pass parameter to another block. but i have error message.
    error:PL/SQL: ORA-00904: "C1DATA_REF"."c": invalid identifier.
    Would you help me?
    ___________________________+++my code+++
    CREATE OR REPLACE PROCEDURE GETID
    (a IN TEST.COUNTRY%TYPE,
    b IN TEST.STATE%TYPE) AS
    V_ID TEST2.c%TYPE;
    CURSOR C1_DATA IS
    SELECT a,b,c FROM TESTSURVEYUNITS WHERE COUNTRY=a
    AND STATE=b ;
    BEGIN
    BEGIN
    FOR C1DATA_REF IN C1_DATA LOOP
    DBMS_OUTPUT.PUT_LINE ('SVU_ID IS:' || C1DATA_REF.c);
    END LOOP;
    END;
    BEGIN
    SELECT e,f,g,c FROM TEST2 WHERE SVU_ID=C1DATA_REF.c;
    DBMS_OUTPUT.PUT_LINE('PART 2'||C1DATA_REF.c||C1DATA_REF.e);
    END;
    END;

    Here it is reformatted. The SELECT statement in the second block won't work because there is no INTO clause and also because the cursor for loop in the previous block is out of scope. The loop has fetched all of its rows and has completed. What are you trying to do with the second select statement?
    CREATE OR REPLACE
    PROCEDURE GETID (a IN TEST.COUNTRY%TYPE
                    ,b IN TEST.STATE%TYPE) AS
    V_ID TEST2.c%TYPE;
    CURSOR C1_DATA IS
    SELECT a,b,c
    FROM   TESTSURVEYUNITS
    WHERE  COUNTRY=a
    AND    STATE=b ;
    BEGIN
       BEGIN
          FOR C1DATA_REF IN C1_DATA LOOP
             DBMS_OUTPUT.PUT_LINE ('SVU_ID IS:' || C1DATA_REF.c);
          END LOOP;
       END;
       BEGIN
          SELECT e,f,g,c
          FROM   TEST2
          WHERE  SVU_ID=C1DATA_REF.c;
          DBMS_OUTPUT.PUT_LINE('PART 2'||C1DATA_REF.c||C1DATA_REF.e);
       END;
    END;

  • Pass parameter to another page and stay on same page?

    Greeting EveryBody,,,
    as u can see from the subject
    im trying to pass parameter from one page to another but i want to stay on the original page???
    can be done or not? and how?
    examples are welcomed
    thanx in advance
    best regards
    carlito

    i have three pages displayed all by <frameset>
    and i want to pass parameter from one page to another without going to any page!!! i.e. staying on the main page
    hope it clear now....
    best wishes

  • Pass parameter to another report

    Hello
    I am using report 10g, I want to call another report from within the report, but my problem is that i want to pass the parameter like custid from the running report as a parameter to the second report.
    Please help me
    Thanks
    Hardip

    Hardip,
    on teh web you use a hyperlink in Oracle Reports that calls the next Report via a relative URL addressing. Check teh Reports documentation about hyperlink items.
    Frank

  • Portlet event link to pass parameter between portlets

    Ok list, I followed the documentation Adding Parameters and Events to Portlets
    PDK Release 2 (9.0.2 and later) and tried to make a portlet that pass parameter to another portlet using event link. I created the supposed parameter in the page and made the correct association to the receiving parameter portlet. The case is: The parameter is not caught in the receiving parameter page.
    This is my event link jsp code:
    <%
    String sImgPath = PropertiesReader.getProperty(PropertiesReader.KEY_IMAGES_PATH);
    PortletRenderRequest portletRequest = (PortletRenderRequest)request.getAttribute(HttpCommonConstants.PORTLET_RENDER_REQUEST);
    // The portlet definition in provider.xml includes the following:
    // - Event "submit" with event parameters "funcionalidade"
    String eventSubmit = EventUtils.eventName("submit");
    String eventParamFuncionalidade = EventUtils.eventParameter("funcionalidade");
    // Build up the list of parameters for the "submit" event
    NameValuePair[] eventSubmitParams = new NameValuePair[2];
    // Give the 'funcionalidade' event parameter the constant value 'chat'
    eventSubmitParams[0] = new NameValuePair(eventParamFuncionalidade, "chat");
    // The event name must be passed as a parameter on the URL
    eventSubmitParams[1] = new NameValuePair(eventSubmit, "");
    %>
    <TABLE CELLPADDING="0" CELLSPACING="0" BORDER="0">
    <TR><TD><a href="<%=PortletRendererUtil.constructLink(portletRequest,   portletRequest.getRenderContext().getEventURL(), eventSubmitParams, true, true)%>"><IMG SRC="<%= sImgPath + "menuButChat.gif" %>" BORDER="0"></a></TD><TR>
    </TRABLE>
    And this is my receiving parameter jsp code:
    <%
    String sFuncionalidade = "";
    PortletRenderRequest portletRequest = (PortletRenderRequest)request.getAttribute(HttpCommonConstants.PORTLET_RENDER_REQUEST);
    // Get the portlet definition - needed to get the public portlet parameters
    PortletDefinition portlet = portletRequest.getPortletDefinition();
    // Get the public portlet parameters
    ParameterDefinition[] parameters = portlet.getInputParameters();
    // Display all values for each of the public portlet parameters
    for (int currParameter = 0; currParameter < parameters.length; currParameter++)
    String name = parameters[currParameter].getName();
    out.println(" <p>name = " + name + "</p> ");
    // Get the parameter values
    String[] values = portletRequest.getParameterValues(name);
    // Display the parameter's values.
    if ( values == null )
    // Null array indicates no values for this parameter.
    out.println(" <p>values i null</p> ");
    else
    out.println(" values nco i null ");
    // Loop through each of the values and display non-null values on a separate line.
    for ( int j = 0; (values != null) && (j < values.length); j++ )
    sFuncionalidade = values[j];
    out.println(" <p>" + sFuncionalidade + "</p> ");
    %>
    And this is my portlet definition in provider.xml:
    <portlet class="oracle.portal.provider.v2.DefaultPortletDefinition">
    <id>3</id>
    <name>MenuColaboracao</name>
    <title>Menu de Colaboragco</title>
    <shortTitle>Menu de Colaboragco</shortTitle>
    <description>Portlet de menu para funcionalidade de Comuicagco e Colaboragco.</description>
    <timeout>10000</timeout>
    <timeoutMessage>Portlet timed out</timeoutMessage>
    <showEdit>false</showEdit>
    <showEditDefault>false</showEditDefault>
    <showPreview>false</showPreview>
    <showDetails>false</showDetails>
    <hasHelp>false</hasHelp>
    <hasAbout>false</hasAbout>
    <acceptContentType>text/html</acceptContentType>
    <renderer class="oracle.portal.provider.v2.render.RenderManager">
    <renderContainer>false</renderContainer>
    <contentType>text/html</contentType>
    <showPage>/menuColaboracao.jsp</showPage>
    <pageParameterName>next_page</pageParameterName>
    </renderer>
         <event class="oracle.portal.provider.v2.DefaultEventDefinition">
         <name>submit</name>
    <description>Use this event to submit the form data to a page</description>
    <parameter class="oracle.portal.provider.v2.DefaultParameterDefinition">
    <name>funcionalidade</name>
    <displayName>funcionalidade</displayName>
    <description>Parbmetro que indica a funcionalidade a ser apresentada.</description>
    </parameter>
    </event>
    </portlet>
    <portlet class="oracle.portal.provider.v2.DefaultPortletDefinition">
    <id>4</id>
    <name>HomeController</name>
    <title>Home Controller</title>
    <shortTitle>Home Controller</shortTitle>
    <description>Portlet que controla a exibigco do jsp correspondente a opgco de menu selecionada.</description>
    <timeout>10000</timeout>
    <timeoutMessage>Portlet timed out</timeoutMessage>
    <showEdit>false</showEdit>
    <showEditDefault>false</showEditDefault>
    <showPreview>false</showPreview>
    <showDetails>false</showDetails>
    <hasHelp>false</hasHelp>
    <hasAbout>false</hasAbout>
    <acceptContentType>text/html</acceptContentType>
    <renderer class="oracle.portal.provider.v2.render.RenderManager">
    <renderContainer>false</renderContainer>
    <contentType>text/html</contentType>
    <showPage>/homeController.jsp</showPage>
    <pageParameterName>next_page</pageParameterName>
    </renderer>
         <inputParameter class="oracle.portal.provider.v2.DefaultParameterDefinition">
         <name>funcionalidade</name>
    <displayName>funcionalidade</displayName>
    <description>Parbmetro que indica a funcionalidade a ser apresentada.</description>
    </inputParameter>
    </portlet>
    Where do I miss ???
    Any help will be appreciated.
    Regards,
    Leandro.

    Leandro,
    Few things which you might want to cross check to see if we are
    on the right track :
    1. Page containing Parameter receiving portlet contains a
    paga parameter mapped on to its public parameter.
    As per your example, parameter receiving page should have a page
    parameter with name - "funcionalidade" - and portlet's corresponding
    parmeter should be mapped to this page parameter. This can be
    done through "Parameters" tab in the Page Properties screen.
    2. Page containing Parameter passing portlet contains proper event
    mapping.
    As per your example, we have an event called "submit". We should
    be able to see "submit" event under "MenuColaboracao" portlet.
    When this event is raised, select which page should receive the event
    data. As soon as a page is selected, this page's public parameters
    are displayed below. Beside that we must be able to see a choice box
    which displays four choices one of which would be "Event Output".
    Map this output to the event parameter.
    Hope it helps.
    -AMJAD.

  • Passing parameter between two applets

    hi all,
    i want to pass parameter between two applets. in other words, when user clicks the button; close the running applet, pass parameter to another applet and run another applet.
    now i think that could be, ( creating a parameter table in database, when user click on button write parameters to table and stop active applet and run other applet. when other applet runs in init methot it takes parameter from table). but it will be very indirect way.
    if you have an idea or information, plesae tell me.
    thanks for your interest

    Hi ,
    Plz pay a visit to this wonderful website,
    http://www.rgagnon.com/javadetails/java-0022.html / http://www.rgagnon.com/howto.html
    Best Wishes,
    Gaurav
    PS : Thanks to Real Gagnon. This is all I can do at this stage, but wanted to say you are doing a wonderful job.

  • Pass Parameter to Servlet

    How can i pass parameter from a JSP form (depends on what user chooses from a select box to a Servlet.
    I need to call multiple query based on what parameter choosen and display the result in table view.
    Example :
    1. User select choice1 from JSP form -> Servlet : call query Select * from Table1 where cond = choice1;
    2. User select choice2 from JSP form -> Servlet : call query Select * from Table1 where cond = choice2;
    Any sample code?
    Thanks for any help.

    Thanks melondck.
    I have this Servlet which i want it to run queries and display results in table format. I know there's something wrong with the code. But i am new to Servlet/Java. Thanks for anyone who point me the mistakes. Thanks.
    <code>
    package mypackage;
    import java.sql.*;
    import javax.servlet.http.*;
    import java.io.*;
    import javax.servlet.*;
    public class DisplayServlet extends HttpServlet {
    public void doGet(HttpServletRequest req, HttpServletResponse rsp)
    throws ServletException, IOException {
    rsp.setContentType("text/html");
    String url="jdbc:mysql://localhost/smdb";
    Connection con = null;
    Statement stmt = null;
    ResultSet rs = null;
    String query;
    ServletOutputStream out = rsp.getOutputStream();
    PrintWriter out1 = rsp.getWriter();
    String answer = req.getParameter("answer");
    out1.println("<html>");
    out1.println("<head><title> Inventory: </title></head>");
    out1.println("<body>");
    if (answer == null) {
    StringBuffer action = HttpUtils.getRequestURL(req);
    out1.println("<form action=\"" + action + "\" method=\"POST\">\n");
    out1.println("<p><b>Please select:</b></p>");
    out1.println("<p><input type=\"radio\" name=\"answer\" " +
    "value=\"A\" /> Display All <br />");
    out1.println(" <input type=\"radio\" name=\"answer\" " +
    "value=\"B\" /> Device <br />");
    out1.println(" <input type=\"radio\" name=\"answer\" " +
    "value=\"C\" /> Manufacturer <br />");
    out1.println(" <input type=\"radio\" name=\"answer\" " +
    "value=\"D\" /> Location <br />");
    out1.println(" <input type=\"submit\" value=\"Submit\" /></p>");
    out1.println("</form>");
    } else {
    try {
    Class.forName("com.mysql.jdbc.Driver");
    con = DriverManager.getConnection (url, "user", "mypass");
    stmt = con.createStatement();
    if (answer.equals("A")) {
    query = "SELECT Device, LocFloor FROM Inventory";
    esleif (answer.equals("B)) {
    query = "SELECT Device, LocFloor FROM Inventory where ....";
    ResultSet result = stmt.executeQuery(query);
    //Display the result set in a HTML table
    out.println("<HTML><HEAD><TITLE>List</TITLE></HEAD>");
    out.println("<BODY>");
    out.println("<FORM NAME='form' ");
    out.println("METHOD='GET'><TABLE BORDER='1' CELLSPACING='2' CELLPADDING='2'>");
    out.println("<TR><TH></TH><TH>Device Type</TH><TH>Floor</TH></TR>");
    while(result.next()) {
    String type = result.getString("Device");
    String flr = result.getString("LocFloor");
    out.println("<TD>" + type + "</TD>");
    out.println("<TD>" + flr + "</TD>");
    catch(ClassNotFoundException e) {
    out.println("Could not load database driver: " + e.getMessage());
    catch(SQLException e) {
    out.println("SQLException caught: " + e.getMessage());
    finally {
    //close the database connection.
    try {
    if (con != null) con.close();
    catch (SQLException e) {}
    out.println("</body></html>");
    </code>

  • How to pass parameter from 1 stored procedure to another stored procedure inside crystal report

    Hi
    I have several stored procedure in my Crystal Report. I am wondering if it is possible for me to pass a parameter to one of the stored procedure and to use the result of that stored procedure E.g. CustomerCode. To another 2 stored procedure to generate the report dynamically?
    I have 3 stored procedure
    The 1st one is used to gather information and process the calculation
    another 2 stored procedure is used for generate the graph and both of them required to take 2 parameters. The 1st stored procedure will require 1 parameter (E.G. Reference Code) and will return a set of information including the data that could be use on the other 2 stored procedures.
    After I added these 2 stored procedure, it requires me to pass 3 parameters to the report. I would like to know if I could only pass the Reference Code for stored procedure 1 and use it to retrieve the information for the other 2 parameter?
    Thanks in advance
    Chi

    Hi Chi
    To pass parameter from 1 stored procedure to another stored procedure, you will have to create sub report. In your case you will have to create 2 sub reports for 2nd and 3rd stored procedure and link those sub reports with the main report using Reference Code field in order to pass the values.
    After creating the report when you will refresh the report, it will ask 4 parameters, one parameter for main report, one for the first subreport and two for second subreport to fetch the data correctly.
    Regards
    Poonam Thorat.

  • 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 do I pass parameter to different portlet regions from another page?

    How do I pass parameter to different portlet regions from
    another page?
    I have a page that with two regions. Each region has a report
    that uses the same information to generate its report.
    Individually running the reports, I can use p_arg_names and
    p_arg_values to get what I want. However, when I run the page
    that has both portlets, my .show is gone and I cannot get it to
    use the p_arg_names, etc. Do you have any idea how to overcome
    this? Thanks for any help.

    How do I pass parameter to different portlet regions from
    another page?
    I have a page that with two regions. Each region has a report
    that uses the same information to generate its report.
    Individually running the reports, I can use p_arg_names and
    p_arg_values to get what I want. However, when I run the page
    that has both portlets, my .show is gone and I cannot get it to
    use the p_arg_names, etc. Do you have any idea how to overcome
    this? Thanks for any help.

  • How to Pass Parameter a form to another form ?

    Hi,
    I want to pass Parameter a form to another called form.
    What are the steps i want to do.
    Please guide me
    kanish
    Edited by: Kanish on Jul 21, 2010 11:38 PM

    Besides the two options FormsEleven gave, there's a third one: package variables.
    Create a package in a Forms library, define a variable in the package specification.
    Start the form with call_form/open_form with the option "SHARE_LIBRARY_DATA".

  • Passing parameter values to another report using URL actions (reportserver)

    Hi guys,
    I have two reports that I link with eachother. For report A - B everything works perfect. When I try to do the same for report B - A it works, but the parameter value is not filled in.
    =Iif(
    Parameters!PAR_LinksEnabled.Value, 
    Globals!ReportServerUrl & "?" & Replace(Globals!ReportServerUrl, "_vti_bin/ReportServer", "")
    & "Reporting/POS Reporting/Reports/POS Report.rdl&POS_ID=" & Parameters!CONNECTION_ID.Value & "&POS_LANG=" & Parameters!POS_LANG.Value & "&PAR_Date=%5BDate invoice%5D.%5BBonus Calendar - Week%5D.%5BBonus
    week of year%5D.%26%5B" & Left(Parameters!YEAR_WEEK.Label, 4) + "%5D%26%5B" & CInt(Right(Parameters!YEAR_WEEK.Label, 2)) & "%5D",
    Nothing
    Even tho I specify the parameter he has to pass through, the report opens with parameter period : <select a value>. Anyone has an idea why such behaviour happens?
    Thanks!

    Hi Yvanlathem,
    Per my understanding that you want to use the expression above to conditional add the hyperlink to pass the value to the parameter of anpother rreport via the URL in the SharePoint integrated mode report server, right?
    I have check the expression you have provided and the issue can be caused by the wrong way you have write the expression to pass the parameter, please check detais information below to make sure you have pass parameter in the URL correctly:
    Please modify the expression to below structure :
     =Iif( Parameters!PAR_LinksEnabled.Value="Enabled", "URL",Nothing)
    I saw you have use expression like "&POS_ID=" & Parameters!CONNECTION_ID.Value & "" which is incorrect, we need to set a report parameter within a URL, use the following syntax:
     parameter=value(not Value=Parameter)
    If you are using the following syntax like "Parameter1=Parameter2", both parameters and from different report, if you have add the "Go to URL" action from  report2 to Report1, please make sure Parameter1 is from the Report1
    and Parameter2 is from Report2, change the order will not work
    More detail information:
    Pass a Report Parameter Within a URL
    So, In your scenario, please make sure the value is from one report's field (POS_ID) and the the parameter(CONNECTION_ID) is from another report (e.g:"&CONNECTION_ID=" &Fields!POS_ID.Value &"")
    Similar thread for your reference:
    SSRS 2012 Drill Through report cascading Parameters not refreshing
    If you still have any problem, please feel free to ask.
    Regards,
    Vicky Liu
    Vicky Liu
    TechNet Community Support

  • Not able to pass parameter from one fragment to another fragment in another taskFlow

    Hi,
    I'm trying to pass parameter from one fragment to another fragment and want to print the parameter value in second fragment.
    i have inputtext in first frag---
    first fragment belongs to one taskflow1 and this taskflow1 i had darg and drop to one mainPage.
    Under taskflow1 itself i drag and drop one taskflow call activity and on top of that i drag and drop another bounded taskflow as taskflow2
    under taskflow2 i have one fragment as fragment2and in that i have one outputtext field, now here i want to print the value from fragment1--inputtextfield value
    to achive this i had tried many ways but somewhere doing mistake please explain step by step.
    Thanks
    Mahesh

    In addition you need to tell us your jdev version!
    Can you elaborate on your use case a be more?
    On which event this should happen?
    In general contextual events should allow you to implement this, however, as I don't understand the use case, I find it hard to help.
    Timo

  • Passing parameter from task flow to another ADF Taskflow

    Hallo everyone, I have a case :
    1. I have ADF Bounded Task Flow, it contains two main elements - page P1 and another ADF Task Flow call - C1
    2. Page P1 has an atribut employee number as command image link,
    this command will call C1 and passing empNum as parameter
    3. C1 containts two page fragment , Pf1 and Pf2. Default activity is Pf1
    4. Ineed to pass parameter empNumb  available in P1 into ADF Task Flow call C1..
    Is it possible when I click command image link, then it will call Pf2 in C1 ?
    Please help.
    Regards,
    samantha

    Hi Samantha,
    You mean to say, u want to skip the default activity Pf1 in C1?
    And for passing parameters use Add a parameter in your taskflow. (put the empnumber in pageflowscope and pass that as a parameter to the new taskflow C1).
    Thanks

  • Error while passing parameter in Oracle Jdeveloper

    Hi All,
    I was passed Crystal report viewer object  From Servlet it is Running fine but one problem in that while passing parameter from that page  to data base it is not supporting (The ok Button on page).
    can any one tell me how to find Action Button (.Jsp page)
    Because i am using .jsp  page That was made in CR4E
    in that i found only jsp code I have not get how to work Action of that button
    Also another problem while making Viewer.jsp pge ..rpt-Crystal reports--->>Create Viewer Jsp->>Insert CrysatlReport viewer API code------->>>1.Connectparameterinthat report 2.connect the crystalreportPageViewer  while makin this page  i was running on Apache tomcat Server it is not displaying Anything only Displaying Blank Browser
    Can Any one help me...
    Sincerly
    Amol

    For your first question can you please be a little more clear as to what you are referring to?  I am not familiar with an action button for the parameter pages.... what I can tell you is that we don't have any jsp code for the viewer controls, all of that is generated dynamically at runtime.  We do have a viewer SDK that you can use to set properties on the viewer; information about this can be found in the [Developer Library|https://boc.sdn.sap.com/developer/library] in the Viewer SDK documentation book.
    For your second question, I assume you are referring to generating a viewer page from a report in Crystal Reports for Eclipse.  You will need to uncomment the viewer code (for some reason when the page is generated, the viewer code has block comments surrounding it).  You will probably want to make sure the parameter code is uncommented as well. 
    In addition to this, there is a helper file called JRCHelperSample.java that contains all of the helper methods for the automatically generated viewer page.  This can be modified in whatever way you wish to suit your needs.

Maybe you are looking for

  • Checkin originals in background

    Hello, I am an ABAPer, and I am using 'BAPI_DOCUMENT_CREATE2' to create document and checkin original files. BAPI is working fine in R/3 (via SE37) with the file on my PC (C:\temp\file.doc). But, when I call call this BAPI from portal (frontend), doc

  • Recommended patches on oracle 10.2.0.4 RAC database and CRS

    Hi, This week I am planning to upgrade my oracle 10.2.0.2 RAC database oracle 10.2.0.4. Also, I want to apply if any recommended patches we can apply on 10.2.0.4 database or on CRS 10.2.0.4 I searched in metalink, but in vain i didn't get any exact p

  • Expanding iTunes fields to handle more info about each CD (Mac & PC)

    The LP and CD covers often hold a lot of important info about the album, music and artist, producer, history. With the use of physical album covers on the decline as we use iTunes/mp3s more and more, a lot of liner notes and credits are no longer wit

  • Problem with latest Photoshop Update

    A friend on Windows 7 updated Photoshop CS6 last night. He had previously updated RAW to 7.4 with no problems. When he updated the main Photoshop program he discovered in Bridge that he could no longer do a bulk highlight of images. In other words, l

  • Nikon 28-70 f/2.8 and 17-35 f/2.8 lens Profile.

    Can somebody share these two profiles? I don't have these profiles and I am using D700. Anybody please?