Setting parameters in a servlet

Hi,
Is it possible to create a paramater in a servlet then retrieve that value from within a JSP using a request.getParameter() after invoking a requstDispatcher.forward()?

You'd have to wrap the HttpServletRequest object with a wrapper class before it gets to your code (HttpServletRequestWrapper does this), and then add the ability to store additional parameters that can be retrieved with the getParameter() method. You might need to write a router servlet first, and then do a rd.forward() to your own servlets with the new wrapped request object. Perhaps this is necessary in your case, but if request.setAttribute() serves the purpose you need, it's probably easier to do that.

Similar Messages

  • Setting up the XSQL Servlet engine

    I am trying to set up the XSQL servlet component of 9iAS. From what I read all of the necessary components are included in 9iAS, there is no need to download the XSQL servlet from technet. Is this true? I try to run the demo's (e.g. hello world) but am always getting a connection refused error. I edited the XSQLConfig.xml file to include the host, port and sid but still no luck.
    I am at a loss. I have 8.1.7 SE database installed with JDBC drivers, 9iAS 1.0.2. Is this all I need or do I have to download something else.

    Steven,
    Thanks for responding. I am a DBA so I'm only 50% incompetent. The 9iAS version is 1.0.2.1.0 Solaris and the DB is 8i SE, right now on the same Solaris box. The Jserv and JSP demos on the initial install home page work fine and I was able to get Oracle Portal running etc. so I think the Server is working. When I check the installed products for the DB I see several JDBC drivers appear to be installed.
    segmet from XSQLConfig.xml:
    <connection name="demo">
    <username>scott</username>
    <password>tiger</password>
    <dburl>jdbc:oracle:thin:@192.100.146.22:1521:NPGSDEV</dburl>
    <driver>oracle.jdbc.driver.OracleDriver</driver>
    </connection>
    I can connect scott/tiger@npgsdev in sqlplus as well as tnsping npgsdev and the port is 1521 so the tnslistener is up and running.
    I can call up the demo page at: http://192.100.146.22:7777/xsql/java/xsql/index.html
    but any attempt to run them gives:
    Oracle XSQL Servlet Page Processor 1.0.0.0 (Production)
    Oracle XSQL Servlet Page Processor 1.0.0.0 (Production)
    XSQL-007: Cannot acquire a database connection to process page.
    Io exception: Connection refused(DESCRIPTION=(TMP=)(VSNNUM=135294976)(ERR=12505)(ERROR_STACK=(ERROR=(CODE=12505)(EMFI=4))))
    Any help would be greatly appreciated. -quinn

  • Passing Runtime initialization parameters to a Servlet

    Hi all.
    Plz.let me know, how do you pass runtime initialization parameters to a Servlet. Also, when do we need this approach. Thank You.

    Global parameters that may change should be passed as parameters so that the servlet doesn't have to be recompiled to make the change.
    Here a global parameter is used to store a timeOut value. This value is written to every web page to force the page to refresh.
    <web-app>
        <servlet>
            <servlet-name>
                KioskServlet
            </servlet-name>
            <servlet-class>
                KioskServlet
            </servlet-class>
            <init-param>
                <!-- number of seconds of inactivity until timing out -->
                <!-- 300 = 5 minutes -->
                <param-name>timeoutValue</param-name>
                <param-value>300</param-value>
            </init-param>
         </servlet>
    </webapp>

  • Unable to set parameters for "Act as Prox" in OBI11g

    Hi Gurus,
    following Mark Rittman's blog I was able to set parameters and I could use this feature in OBI10g.
    However, in OBI 11g I was not able.
    1. In the init block of Proxyblock I am not able to add SET_RUNAS to Execution Precedence
    The Add button is inactive.
    2. In the init block of Proxylevel I am not able to add Proxyblock to Execution Precedence .
    Only the SET_RUNAS available.
    What to do?
    Any ideas and help are appreciated!
    Thanks
    Laszlo

    Hi Laszlo,
    Check this,
    Re: Unable to select Connection pool when creating init block for current_month
    Regards,
    Dpka

  • Can't define init parameters for multiple servlets

    I want to define init parameters for two servlets in the web.xml file but i only get null for my Login servlet
    <web-app>
    <servlet>
    <servlet-name>
    RSServlet
    </servlet-name>
    <servlet-class>
    RoadSafe.Servlet.RSServlet
    </servlet-class>
    <init-param>
    <param-name>serverip</param-name>
    <param-value>localhost</param-value>
    </init-param>
         <load-on-startup>
              2
         </load-on-startup>
    </servlet>
         <servlet>
    <servlet-name>
    Login
    </servlet-name>
    <servlet-class>
    RoadSafe.AdMisc.Login
    </servlet-class>
    <init-param>
    <param-name>serverip2</param-name>
    <param-value>localhost</param-value>
    </init-param>
         <load-on-startup>
              1
         </load-on-startup>
    </servlet>
    <servlet-mapping>
    <servlet-name>
    RSServlet
    </servlet-name>
    <url-pattern>
    /RSServlet
    </url-pattern>
    </servlet-mapping>
    <servlet-mapping>
    <servlet-name>
    Login
    </servlet-name>
    <url-pattern>
    /Login
    </url-pattern>
    </servlet-mapping>
    </web-app>

    In the code for you Login servlet, are you using the name "serverip2" to access the initial parameter ?
    Thats the name you have used in the web.xml file.

  • Parameterized constructor in servlets

    why can't we use parameterized constructor in servlets?
    please describe it briefly?

    Why should you use parametrized constructor with servlet? If you want to pass any parameter then use <init-param> in web.xml. Even if you make parameterized constructor, how it would be invoked? Servlet container creates instance of servlet by invoking common constructor.
    So do you intent to rewrote container to invoke parameterized constructor?
    Please refer servlet documentation for more information on servlets and it would help you.

  • How to pass parameters/atrributes to Servlet from ALBPM

    HI Friends,
    I am invoking servlet from bpm using server configuration, i am able to invoke servlet, but not able to pass parameters dynamically,
    Also I like to receive response parameters/attributes from servlets?
    Can any body help me on this?
    Look forward for response.
    Cheers

    Some helpful Docs on the WebServer component for you:
    The WebServer component is used to send HTTP requests to an HTTP server and capture the responses. It supports HTTP methods GET and POST.
    The body of the HTTP response is available in the WebServer.response attribute (String).
    Note: This component is superseded by the Fuego.NetX.AdvancedWebServer component, which provides better performance and more functionality like support for proxies and for more HTTP methods (like PUT and DELETE).
    Example: Get Oracle's website home page and save it to a file.
    getFrom(WebServer, url : "http://oracle.com", args : null)
    binaryResponse = Binary(text: WebServer.response,
    encoding: "UTF8")
    BinaryFile.writeFromBinaryTo(data : binaryResponse,
    name : "/tmp/oracle_index.html",
    append : false)

  • Setting Application Set Parameters For Variable

    Hi Guys,
    When I've read the BPC help about "Setting application set parameters" and the statement likes this : 
    Allows you to define a custom email message that is sent when a work status code is changed. The message is applicable to all applications in the application set. You can customize the message using the following variables:
    %USER% - name of user who changed the status
    %ED% - Entity dimension
    %EM% - Entity member
    %CD% - Category dimension
    %CM% - Category member
    %TD% - Time dimension
    %TM% - Time member
    %STA% - Work status
    %OWNER% - Entity owner
    %TIME% - time of change
    For example, you can enter "This is to inform you that %USER% has updated the work status for %EM%, %CM%, %TM% on %TIME%". The message can be up to 255 characters, and there is no need for quotes or brackets around parameters.
    The Questions:
    When I put the "%ED" into the textfield "APPROVALSTATUSMSG", after that I try to send email from BPF and the "%ED" still same into the email message. But it should describe the value of variable.
    Could you help me how to view the value of variable ?
    Thanks,

    If I look at the available parameters in the helpfile 2 things are strange in my opinion:
    1)the parameter is called approvalstatusmsg, approval status was the V4 naming convention of the function, right now it is called workstatus, so it might be a V4 function. Never used it myself but maybe it is something not correctly migrated to v5.
    2) Even if it is working in V5, which I don't know for sure, then it is strange that you only have variables for Categroy, time and entity, since you can setup the workstatus for more then these 3 dimensions in V5 which you would also like to have in a case you set it up for more then 3 dimensions. For example for if you want to use Category,time,Entity & Product dimension in the workstatus, you would also like to inform the people which product is updated, since only just category,time and entity won't say that much.
    So I think you best check with support if this function is still usable in V5 or if it is an old function from V4. and if it is working in V5, how do you get the right parameters in the variables when you setup workstatus for other dimensions then just Category/time/Entity.
    I would like to know the results!
    Joost

  • Set Parameters in sub reports - can't know which parameter is in sub report

    Hi,
    I am trying to set parameters in reports that some time build from sub reports, the only input that I got is the parameters name(key) and there values.
    What I need is a way to retrieve the parameters from report and set them by the parameter name(key) with it's value.(when I am handle the case of parameter in sub report)
    and hope it's work!!
    any idea how to do this?
    My code is below, and I am using CR/VS2008.
    Thanks,
    Amos
    public class reportGenerator
        public reportGenerator(string reportTemplate, string reportResults, ListDictionary parameters)
            //Instantiate variables
            ReportDocument reportDocument = new ReportDocument();
            reportDocument.Load(reportTemplate);
            // Database Access
            ConnectionInfo connectionInfo = new ConnectionInfo();
            connectionInfo.ServerName = "ServerName";
            connectionInfo.DatabaseName = "DBName";
            connectionInfo.UserID = "UserId";
            connectionInfo.Password = "UserPassword";
            connectionInfo.IntegratedSecurity = false;
            SetDBLogonForReport(connectionInfo, reportDocument);
            reportDocument.SetDatabaseLogon("UserId", "UserPassword", "ServerName", "DBName", false);
            double Num = 0;
            bool isNum = false;
            ParameterDiscreteValue paramValue;
            foreach (System.Collections.DictionaryEntry param in parameters)
                isNum = double.TryParse((string)param.Value, out Num);
                if (isNum)
                    paramValue = new ParameterDiscreteValue();
                    paramValue.Value = Convert.ToDecimal(param.Value);
                    reportDocument.SetParameterValue((string)param.Key, paramValue.Value);
                else
                    reportDocument.SetParameterValue((string)param.Key, param.Value);
            reportDocument.SaveAs(reportResults, true);
        private void SetDBLogonForReport(ConnectionInfo connectionInfo, ReportDocument reportDocument)
            Tables tables = reportDocument.Database.Tables;
            foreach (CrystalDecisions.CrystalReports.Engine.Table table in tables)
                TableLogOnInfo tableLogonInfo = table.LogOnInfo;
                tableLogonInfo.ConnectionInfo = connectionInfo;
                table.ApplyLogOnInfo(tableLogonInfo);

    You should review the SDK guide online because it answers all your questions.
    The [SetParameterValue |http://devlibrary.businessobjects.com/BusinessObjectsXIR2SP2/en/en/CrystalReports_dotNET_SDK/crsdk_net_doc/doc/crsdk_net_doc/html/crlrfCrystalDecisionsCrystalReportsEngineReportDocumentSetParameterValueTopic2.htm]method is overloaded 3 times. One of the overloads takes the name of the parameter, its value, and the name of the subreport it is in.
    public virtual void SetParameterValue(   string name,    object value,    string subreport);
    [Reading and Setting Discrete Parameters|http://devlibrary.businessobjects.com/BusinessObjectsXIR2SP2/en/en/CrystalReports_dotNET_SDK/crsdk_net_doc/doc/crsdk_net_doc/html/crtsktutorialsrdparametersdiscreteintro.htm]

  • Newbie (!) - created a report; have to set parameters to print? How to print it all, please?

    Hi,
    I confess I'm a newbie. I've created my first table and a report based on that table. When I try to print the report, I get a dialogue box asking for the parameters for certain fields. How do I indicate "print all"? Can I save this setting, to
    print all of this document, every time? Do I have to input the parameters for each field, each time I print the document?
    I see the value of setting parameters, but don't need to filter this report.
    Thanks so very much!  Endless gratitude!

    That would explain it.  Because the report no longer recognizes the references it contains to the div_cde column, it treats it as a parameter.  Hence the prompt.  You can change the report design so that every reference to div_cde becomes
    one to div.  This could be in a number of places such as the ControlSource property of a control in the form, or the name of a column (field) by which the report is grouped or ordered, so an easier solution might be to change the table design, renaming
    the div column back to div_cde.  The report should then work without amendment.
    Ken Sheridan, Stafford, England

  • I'm new to the LabView. How do I pass data from VI configured using Serial (CMTS using CLI commands to set Parameters ) to VI configured using GPIB(vecto​r signal analyzer ) to measure such as RF frequency or power on the instrument​? Thanks

    I'm new to the LabView. How do I pass data from VI configured using Serial (CMTS using CLI commands to set Parameters ) to VI configured using GPIB(vector signal analyzer ) to measure such as RF frequency or power on the instrument?
    I just want to set something on the front panel that will execute the Serial parameters first and then pass these settings to vector signal analyzer
    Thanks
    Phong

    You transfer data with wires.
    Frankly, I'm a little confused by your question. I can't think of any reason why you would want to pass serial parameters (i.e. baud rate, parity) to a GPIB instrument. Please explain with further detail and attach the code.

  • Set a timer in servlet

    i want to set a timer of 10 min in one of my pages(im using servlets) and i want to redirect a user to a different page after that period of time.i tried to use a loop using thread.sleep(),but it is not working.to redirect to a different page i uused refresh parameters but getting error 405.please help...

    That's not how it should be done. JSP/ Servlets are server side technology and the code runs on the server before the page is generated. Once the page is sent to the client, your JSP/ Servlet has long since finished servicing that particular request and you cannot do anything to that response now, once it's committed.
    You can do this with either:
    - JavaScript, setting a timer onload and then doing what you want
    - Using META tags [1] to refresh or redirect
    Be aware that both of these can fail and you should always give a link to the page unless you want your user to be stranded. And also, just as a preemptive measure, JavaScript != Java so if you decide to go that way, you'll need to post your queries in some JavaScript forum and not in the Java forums.
    [1] http://en.wikipedia.org/wiki/Meta_refresh
    People on the forum help others voluntarily, it's not their job.
    Help them help you.
    Learn how to ask questions first: http://faq.javaranch.com/java/HowToAskQuestionsOnJavaRanch
    ----------------------------------------------------------------

  • How to set Parameters in RRW3_GET_QUERY_VIEW_DATA

    Hello All,
    I am trying to use RRW3_GET_QUERY_VIEW_DATA function module for executing a query. Currently i am stuck big time figuring out how to set the parameters in  I_T_PARAMETER.
    I my case i need to run a query with the following key,value pairs
    1. 0I_FY_OP    =  001.2004
    2. ZHWORKCT = ABC
    Can some one throw more light into how to set the above parameters into I_T_PARAMETER??
    Thanks a  lot,
    Naveen

    Hello Prathibha,
    Thanks for the quick respone. I did go though the weblog and am trying to find my way through the documentation. I was wondering if the BW gurus could point me to some useful tips or examples.
    Thanks a lot,
    Naveen

  • How to set parameters in CR4E

    Hi,
    Need:
    To generate PDF reports from standalone java program using CR4E runtime engine. Reports will be designed using CR4E. The java program will use CR4E engine APIs to open the report and populate date in it from database.
    Scenario:
    I have created a report and mapped the report fields from SQL file (similar to using it as SQL command). I have also created 2 parameters and also included in the SQL file.
    Problem:
    1) These parameters don't prompt when run within CR4E designer & i see no way to set these values to work in preview mode and it appears as a blank page. Bcos of above reason, my java application when executed also gnerates blank report as the parameters are not set. How to resolve this?
    2) Then i tried using record filters to map the SQL file field name to parameter name in the report. Now, when previewed the prompts for parameters appeared and the report was displayed as expected. But, when the java application gave 'FormulaException: Field name not known' error (with mention to SQL field names used in filter). I am not using any formula in my report so this error is bcos of using record filter. How to resolve this error?
    Finally, i need a design & runtime solution to execute my reports with parameters.
    TIA,
    M.Ravi

    Ravi,
    Have you tried searching through the rest of the threads in this forum, I am sure all your questions have
    been asked and answered before.
    As to your last comment, I personally try steer away from people demanding help so maybe not
    putting such comments in the forums would help get people to reply to you. Sometimes the people who
    know the answers are busy doing other things for a day or two, so sometimes you need to be patient.
    Just a thought.

  • How to get checked parameters in a servlets or Action's?

    i am using a for loop for creating Checkboxes in my JSP and i am finding it difficult to get the set of checked values into my next servlet or jsp i.e. to which ever my request is forwarded..
    the logic i used in my jsp for creating my Check boxes is
    <%for(int i=0;i<10;i++){%>
    <input type=checkbox name="<%=i%>" value="check box <%=i%> selected">
    <%}%>
    and i want to get all the check boxes i checked in my next Action..
    any one plz help me on this..

    You may want to try this other approach:
    On the JSP
    <%for(int i=0;i<10;i++){%>
        <input type=checkbox name="checkbox" value="check box <%=i%> selected">
    <%}%>On the servlet
    String[] checkboxes = request.getParameterValues("checkbox");
    for(int i = 0; i < checkboxes.length; i++){
       //whatever you need the values to
    }And in case you're keeping your existing code:
    on the servlet
    String checkbox;
    for(int i = 0; (checkbox = request.getParameter(String.valueOf(i)) != null; i++){
       //whatever you need the values to
    }

Maybe you are looking for

  • IDoc not received by the Webmethods

    Dear Abapers, I have a scenario : Here the idoc  is being created perfectly with all the segments prooperly populated.  Also from SAP side, we are getting the message that it has been sent. However, the receiver ( Webemthods) is saying that it is not

  • Auto-prompter facility for Mac Book and iPad

    Just wondering is there anything out there to allow an iPad be used as the Slave, and the Air book be used as the Master as an auto-promter set up. There seems to be an Android solution but don't have any Andriod kit. Thanks

  • Can I install Flash CS4 after installing, activating & updating Photoshop CS5 ?

    Can I install Flash CS4 after installing, activating & updating Photoshop CS5 ?

  • Search subfolders in AFP-Shares

    i have a Qnap TS-439 Pro NAS attached to my network -  i'm trying to search with the finder through a whole networkshare by using cmd+F and choosing the actual directory - the search only finds files in the directory where i'm just in but not in the

  • Why can't I erase HD with Disk Utility?

    I have a MBAir 11" with Mavericks. I want to erase the HD. I go to Disk Utlity>choose Macintosh HD>Erase. All choices are greyed-out (Format, Name, Erase Free Space, Security Options, Erase). I can't choose anything. What am I missing?