Scope from variable

I work with servlets some time, but I don't understand the scope from variable not complete.
Like in JSP with Beans you can store objects in differnt scope:
1. request: --> variable within function (get/post)
2. session: --> HttpSession Object
3. page: --> private variable in servlet or ServletContext???
4. application: -->
every answer is useful
regards Dietmar

With tomcat you can set up more contexts for different applications...
Is the ServletContext different in every application or
is it the same in the whole servlet container?
Thanks Dietmar

Similar Messages

  • Accessing Application Scope from an EJB

    I'm not sure of the best way of doing this:
    The set up:
    We have a rather large J2EE application that is composed of only servlets and JSPs at the moment (When the application began development EJB was in its infancy and not feasible for the development of the app). Some of the new deployments of the app involve distributed webserver over 4 JVMs and 2 machines. When a user connects the servers load balancing decides which particular JVM they should be connected to. We perform large data caching into the servlet application scope to avoid having to access the database every time a change is made by a user to certain tables in our database. The data caches are stored in hashtables in the servlet application scope.We seem to have no way to determine what other JVMs are running or which JVM a user is currently connected to.
    The problem:
    Apparently the application scope is for a particular JVM. This means that when a user makes a change to a data cache the change doesn't effect users in the other 3 JVMs of the application, only the users who, due to load balancing, happened to be connected to the same JVM as the one where the change was made.
    Our possible solution:
    We were thinking that we could set up a queue (such as MQSeries from IBM) and any time a change is made to one of these data caches put a message on the stack saying that the particular table had been updated. Then a MDB would be listening asynchronously and digest the message from the Queue and recache the tables from the database.
    So here are my questions:
    1. Would this work? Would putting a MDB in the EJB Container give each JVM the MDB in the first place, or would this mean it would pick one of the JVMs to deploy the MDB on and still not fix our problem.
    2. If this does work, how do I access the hashtables stored in the Servlet Application scope from the MDB. I can't seem to find any method available to the MDB (or any EJBs for that matter) that can access the servlets Application scope.
    3. Is this the best way to do this? Or is there a better way to share data between seperate JVMs that I don't have a URL to (It's all ambiguous and handled by the server as to which JVM actually gets the connection.)
    Just in case this is needed:
    We are running IBM WebSphere 5 Application Server and the database could be anything from DB2 to Oracle.
    Thanks in advance for any possible help.

    You wont get any api for directly accessing Servlet application objects from any ejb. I dont think MDB either solves your problem directly. Indirectly you can place a request to some servlet (should be there for each JVM and web application ) and update your application scope variable. I would suggest you to cache the data in database if the size of cache is large. otherwise any open caching tools may help you.

  • Currency Translation not working with "Time Reference from Variable"

    We have created several Currency Translations using RSCUR with a fixed "Key Date".  All have been working fine until we got the request to allow a variable date for the exchange rate date.  I have built a variable on 0DATE which I am putting a default date value into using user exit.  This default date is the SAME date as the fixed "Key Date" which we have been using.  Unfortunately when we use the "Time Reference from Variable" option and use this new variable, no currency conversion is taking place, instead it only shows the original currency values.  I am 100% sure that my variable is getting a value and it is the same date we are using for the fixed "Key Date" value so both methods should be using the exact same exchange rates.  The documentation that I can find states:
    ●      Time reference: The time reference for the currency translation can be either fixed or variable.
    If the time reference is fixed, the time at which the exchange rate is determined is independent of the data. You have the following options:
    ○       You can establish that the time reference be determined upon translation.
    ○       You can select the current date.
    ○       You can specify a fixed date as the key date.
    ○       You can specify any variable that exists for InfoObject 0DATE.
    ○       You can establish that the query key date be used. This is determined in the query settings.
    In my case I am only switching from option "You can specify a fixed date as the key date"=(Key Date) to "You can specify any variable that exists for InfoObject 0DATE"=(Time Reference from Variable).
    What am I missing?  Any help is appreciated.

    I neglected to mention that we are calling this currency translation through a WAD button using the SET_CURRENCY_TRANSLATION command.  I did do a test by applying the currency conversion within query key figure.  This seems to work.  So it appears the issue is with how the WAD is processing the variable, not the query.  When I display the variable in a drop down item within the WAD it does have the default value that I have assigned in user exit.

  • What are Parameters? How are they differenet from Variables? Why can't we use variables for passing data from one sequnece to another? What is the advantage of using Parameters instead of Variables?

    Hi All,
    I am new to TestStand. Still in the process of learning it.
    What are Parameters? How are they differenet from Variables? Why can't we use variables for passing data from one sequnece to another? What is the advantage of using Parameters instead of Variables?
    Thanks in advance,
    LaVIEWan
    Solved!
    Go to Solution.

    Hi,
    Using the Parameters is the correct method to pass data into and out of a sub sequence. You assign your data to be passed into or out of a Sequence when you are in the Edit Sequence Call dialog and in the Sequence Parameter list.
    Regards
    Ray Farmer

  • How to use lengthy query in a "SQL Command from Variable"

    My oracle SQL Query length is more than 14000 characters, so how can i use this for "SQL command from variable".
    Sarvan

    Either create a view or a table valued UDF. Using stored procedure in OLEDB source has some gotchas it will not pick up metadata information by default due to late binding.
    http://consultingblogs.emc.com/jamiethomson/archive/2006/12/20/SSIS_3A00_-Using-stored-procedures-inside-an-OLE-DB-Source-component.aspx
    Please Mark This As Answer if it helps to solve the issue Visakh ---------------------------- http://visakhm.blogspot.com/ https://www.facebook.com/VmBlogs

  • Varying result set and binding parameters in sqlcmd from variable

    SSIS  - Support of Multiple versions of our product
    Our Enterprise Data warehouse consolidates data from multiple data sources.  We have a requirement that we should be able to support data collection from different version of these data sources at the same time.
    Ex. Customer has three different versions of our product installed 7.3,  7.3.1 and 7.3.2. The data warehouse would in this case would be on version 7.3.2, but should be able to collect data from prior versions of the data sources.
    We use stored procedures to collect data from sources into our staging area and then we transform and load it on to the warehouse. The design of SSIS packages are that, there is one main package that executes packages for each table that we collect data
    from the source. The main package is invoked per source that we need to collect data from, if there are three sources at run time there will be three instances of the main package running. These packages run on the warehouse machine to pull the data from the
    source system.
    We would like to maintain one version of these packages on the warehouse and support collecting data from different source versions.
    Challenges
    The signature of stored procedures on the source system has changed between versions
    There are some additional fields returned by these stored procedures in the newer release
     Example
     7.3 version signature :
    [dbo].[PDW_GetMediaAgentSummary](@LastVersionID
    AS BIGINT,
    @InitializeDays as
    INT = 60,
    @NextVersionID AS
    BIGINT OUTPUT)
    7.3 Sp1 version signature:  [dbo].[PDW_GetMediaAgentSummary](@LastVersionID
    AS BIGINT,
    @DataStartDate AS
    DateTime2(3),
    @NextVersionID AS
    BIGINT OUTPUT)
     Also, let us say in 7.3 this stored procedure returned 8 fields and 7.3 sp1 it is returning 10 fields.
    The way we are trying to accommodate is to use “SQLCmd from variable” option in the OLE DB source to cover the signature difference, but this option does not allow us to bind parameters
    to variables to get the output value. The second issue of additional fields (or the lack of additional fields from the 7.3 procedure), we tried to turned off the metadata validation, but we get field not found error at run time when we run the SSIS package
    against 7.3 version. Looks like the only way we could solve is to duplicate the data flow tasks, based on the source version. Looking for better way to do this, since this could go out of control as the number of releases increases.
    Appreciate help on this.

    I suggest you branch your package into one route vs another based on some flag that indicates version the package is connected to then it will execute one stored proc or another, this can be done
    using the Precedence Constraints, or make a wrapper stored proc that hides the data differences between the versions.
    Arthur
    MyBlog
    Twitter

  • How to remove leading zeros from variable

    hi,
       how to remove leading zeros from variable like it_vbap-matnr.
    value in it_vbap-matnr is 000000000000000358
    i want to remove leading zeros so that it become 358
    regards
    deepak

    You can use Function Module <b>'CONVERSION_EXIT_MATN1_OUTPUT'</b>
    This Function Module will eliminate leading Zeros.
    For each MATNR Value read form DB Table,u can eliminate Leading zeros and then modify ur Internal table.
    I think u will not get leading Zeros into utr Internal table when u read from VBAP.
    Bcoz MATNR in VBAP itself have Conversion routine.
    If u r getting leading zeros,U can use following Logic.
    tables:
      vbap.
    data:
       t_vbap like standard table of vbap.
    select matnr
    from vbap
    into corresponding fields of table t_vbap.
    loop at t_vbap into vbap.
      CALL FUNCTION 'CONVERSION_EXIT_MATN1_OUTPUT'
          EXPORTING
            INPUT         =  vbap-matnr
          IMPORTING
            OUTPUT        =  vbap-matnr
      modify t_vbap from vbap transporting matnr.
    endloop.
    Hope this will work.....

  • Scope with Variables

    Just a very basic question I have NOT yet managed to get through all of the stuff contained in the manuals but does JavaScript have such a thing? Im eager to start trying to convert some of my AppleScripts to JavaScript as a learning exercise and have not come across anything yet. Also while Im here is the "_" underscore special to Extend Script? I've used this character in function names when using AppleScripts do JavaScript without issue but Extend Script marks it red as if it no like it. TVM

    As for scope are variables all just script wide if you know what I mean in AppleScript I can have "Property", "Global" & "Variable" the later declared inside of a function is local to the function?
    Get the Flanagan JS book. It will explain this stuff in detail. The
    simplified version is that there are two scopes: global and function level.
    In this example, the first x is global and the second is local to the
    function y. The third x is the same variable as the second even though
    it's another declaration.
    This is different that what happens in other C-based languages and still
    trips me up on occasion.
    var x = 10;
    function y() {
       var x = 20;
       if (true) {
         var x = 30;

  • CFPOP and the FROM variable

    I use CFPOP too read mails,
    And I want to do different processing following the email adress found in the
    FROM variable.
    But, depending of the Mail agent sending mails,
    The FROM variable contains different types of values :
    1 - can be the Email (alone)
    2 - can be the name of the person, without any email
    3 - can be the name of the person followed by the email
    4 - can be the name of the person followed by an email of the mail server.
    As I need to find the Email of the sender, only in cases 1 and 3 can give me the right email.
    Can someone explain this ?
    I do not see anything in CF to solve this, even in programming or in the CF administrator.
    I have the impression that , what is retruned in the "FROM" depends of the mail server ?
    Thanks for any help, explanation on that subject,
    Pierre.

    Thanks for your suggestion,
    the header variable does not give the Email adress of the sender,
    it gives the same : the person name.
    here is the result of that variable :
    Received: from [192.168.13.131] by email.images-creations.fr [192.168.13.209] with SmartMax MailMax for [email protected]; Tue, 18 Oct 2011 16:56:29 +0200 Return-Path: X-SmartMax-AuthUser: Received: from mx1-1.images-creations.fr (localhost [127.0.0.1]) by mx1-1-relay.images-creations.fr (Postfix) with ESMTP id 76EC432E0D9 for ; Tue, 18 Oct 2011 16:56:26 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.2.5 (2008-06-10) on mx1-1.images-creations.fr X-Spam-Level: ***** X-Spam-Status: No, score=6.0 required=8.0 tests=BAYES_50,HTML_MESSAGE, LIMSI_S36,RCVD_IN_NJABL_PROXY,TVD_SPACE_RATIO autolearn=no version=3.2.5 Received: from smtp.smtpout.orange.fr (smtp12.smtpout.orange.fr [80.12.242.134]) by mx1-1.images-creations.fr (Postfix) with ESMTP id 63CFE32E0D5 for ; Tue, 18 Oct 2011 16:56:26 +0200 (CEST) Received: from StationDev ([80.14.60.39]) by mwinf5d47 with ME id mEwR1h00J0qnSTU03EwRkh; Tue, 18 Oct 2011 16:56:26 +0200 X-ME-engine: default From: "Pierre LARDE" To: Subject: 13744 Date: Tue, 18 Oct 2011 16:56:24 +0200 Message-ID: <000501cc8da6$1b58e540$520aafc0$@fr> MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_NextPart_000_0006_01CC8DB6.DEE1B540" X-Mailer: Microsoft Office Outlook 12.0 Thread-Index: AcyNpfyCtDyvnB33RuaPaOwckewWUg== Content-Language: fr
    the From is there also the name , not an Email.
    Thanks for any other suggestion,
    Pierre.

  • CFPOP and the FROM variable content

    I use CFPOP with no problem,
    except that when I send from my OutLook,
    the FROM variable content is a name (my name)
    not an Email adress.
    I need the Email adress like : [email protected]
    which is the unic identifier
    I am under CF 7 (or CF 8)
    How to get the Email adress in the  "from" variable of the CFPOP ?
    Thanks to any help
    plarts
    Messages: 6
    Inscription: Dim 21 Mar 2010 17:26
    Message privé
    E-mail

    I send (myself, as an example, could be anybody else) a mail to an Email address xxxx,
    With CFpop I want to get this mail and identify the sender with the Email adress (in the from variable).
    So in the "from" variable of CFpop , I should get the Email adress of the sender.
    Then 2 cases :
    - If the mail is sent from Outlook , the "from" content have the name of the person (not the Email adress)
         (and different person can have the same name)
    - If the mail is sent from a Webmail, the "from" content has the Email adress (format [email protected])
         (the email adress is unique)
    And I need the Email adress (not the name of the sender) to Identify the person in the DataBase.
    Hope, this is clearer ?
    Thanks for your help.
    Pierre

  • Time reference from variable in crcy transl. type

    Hi guys,
    does anybody know, where to create the variables displayed in RSCUR, when I want to create a crcy. transl. type with time reference from variable?
    Thanks in advance, Clemens

    Hi,
    With  step by step :
    http://www.sapdb.info/wp-content/uploads/2008/11/bw-howtousevariablestimereferencesincurrencyconversion.pdf
    with  steps and Definitions :
    http://www.scribd.com/doc/7061035/How-to-Use-Variables-for-Currency-Conversion
    The time reference for the currency translation can be either fixed or variable.
    If the time reference is fixed, the time at which the exchange rate is determined is independent of the data. You have the following options:
    ○       You can establish that the time reference be determined upon translation.
    ○       You can select the current date.
    ○       You can specify a fixed date as the key date.
    ○       You can specify any variable that exists for InfoObject 0DATE.
    ○       You can establish that the query key date be used. This is determined in the query settings.
    If the time reference is variable, the time at which the exchange rate is determined is decided by a time characteristic value.
    ○       A variable time reference can, for example, be determined using the end or start of a fiscal year or calendar year, a period and a month u2013 or even to the exact day. The following standard time characteristics are available: 0FISCYEAR, 0FISCPER, 0CALYEAR, 0CALQUARTER, 0CALMONTH, 0CALWEEK and 0CALDAY.
    ○       The time reference can also be determined using a customer-specific InfoObject of type date (for example, trading day). Note that this InfoObject has to have the same properties as the standard InfoObject selected in the variable time reference or must reference it.
    ○       You can specify an InfoSet: This is only necessary if you are determining the target currency using an InfoObject that exists in the InfoSet more than once. You enter the field alias so that the InfoObject can be specified uniquely.
    In the Business Explorer, you can only set time variable currency translations in query definition, and not for an executed query. See also Setting Variable Target Currency in the Query Designer.
    ○       In the Time Adjustment field of type INT4, you can specify whole numbers with a +/- sign.
    ○       In the Time Adjustment from Variable field, you can specify formula variables (1FORMULA). As these values of the variables may have to be whole numbers, they are rounded to whole numbers (integers) where necessary.
    The time adjustment (regardless of whether it is fixed or variable) is always related to the InfoObject specified under Variable Time Reference.
    Example of a time adjustment of -3:
    The variable time reference is To the exact day and the InfoObject under Variable Time Reference is 0CALDAY. Instead of 07.11.2006, after the time adjustment, 04.11.2006 is used for the translation.
    The variable time reference is End of Week and the InfoObject under Variable Time Reference is 0CALWEEK. Instead of 52.2004, the week 49.2004 is calculated and the end date is calculated from this.
    For more info pls refer this link:
    http://help.sap.com/saphelp_nw2004s/helpdata/EN/80/1a6806e07211d2acb80000e829fbfe/content.htm
    I hope these will helps you.
    Thanks .
    Hema

  • Reagrding write from variable to other...

    Hello,
    I want to know following difference. In case a), the date from variable v_fromdat exactly get copied into a field of internal table chg_roles-from_dat but in case of b) the v_fromdat gets copied with different format.
    a) chg_roles-from_dat = v_fromdat.
    b) write v_fromdat to chg_roles-from_dat.
    Regards,
    Rajesh.

    If we have v_formdat = sy-datum than it will:
    a) chg_roles-from_dat = v_fromdat.
    chg_roles-from_dat  will have 20080814
    Here chg_rols-from_dat should be TYPE D.
    b) write v_fromdat to chg_roles-from_dat.
    chg_roles-form_dat will have 08/14/2008 (based on your date settings MMDDYYYY or DDMMYYYY).
    Here chg_roles-form_dat should be type CHAR10
    Basically this statement WRITES the data to the target variable as it writes the data to output.
    Regards,
    Naimesh Patel

  • ACCESSING APPLICATION SCOPE FROM FILTERS

    HI
    Is there any way to access the application scope from inside security filters? i have a class that implements the Filter interface and i'm trying to access the application scope in the doFilter method.
    The FacesContext Object is null, and i'm only able to access the session scope using request.getSession()
    I want to check for global application properties that are saved in the application scope.
    Thanks

    thank you BalusC it's working

  • Difference between Replacement with a query and Replacement from Variable

    Hi Gurus
    Would explain the difference between the Replacement Path: Replacement with a query and Replacement Path: Replacement from Variable with scenarios.
    Thanks in advance,
    Aravind.S

    Hi,
    If you are using Replacement with query, the given query output will be used as input your variable. For example if you want to display the product details, which can be find our from a query.
    And Replacement with Variable will be used  when you want to give the same input  in two different fields. for example if you want to see the records from sending location and not the records from recived location at the same time. Here once you give the sending location id, it will be taken as the same input for received location.
    Regards,
    Vishnu

  • Excel Sheet Looping: For each loop from variable Enumerator

    Hi,
    Is it possible to do excel sheets looping using For each loop Enumerator as "For Each loop from Variable enumerator" ? If yes, please help.
    Also,
    I have an excel file with 10 sheets, but want to loop only 5 sheets. Please help..how can i achieve this. 
    Actually i tried with
    1> stored the 5 sheets name into a variable (say 'SheetsName') of type string using script task
    2> For each loop container
       enumerator - 'For each ADO Schema Rowset enumerator'
       connection: ADO
       schema: 'Tables'
       variable mapping: 'User::SheetsName'
    3> Within For each loop container added a data flow task
    4> Inside DFT - excel source - 
       Data access Mode: 'Table Name or view name variable'
       Variable Name: 'SheetsName'
    but this loops through all the 10 sheets irrespective of only 5 sheets names stored in the variable "SheetsName".
    Please help...
    Please Mark as Answer if my post solved your problem or Vote As Helpful if this helps. Blogs: www.sqlserver2005forum.blogspot.com

    >> Is it possible to do excel sheets looping using For each loop Enumerator as "For Each loop from Variable enumerator" ? If yes, please help.
    I don't think so. To loop through all worksheets of Excel For ADO.NET Schema Rowset Enumerator is the only option.
    Please refer:
    https://msdn.microsoft.com/en-us/library/ms345182(v=sql.110).aspx
    >> I have an excel file with 10 sheets, but want to loop only 5 sheets
    So you have configured For Each loop container which loops throgh all sheets and returns you sheet name to variable "SheetName".
    Drag and drop one Sequence Container inside ForEach Loop Container and connect it to Data Flow Task.
    Right click on connector and use expression: (which will check if current sheet is one of 5 required sheets)
    @User::SheetName == "FirstSheet" ||  @User::SheetName == "SecondSheet" || .....
    Below blog demonstrates kind of simillar steps:
    http://www.bidn.com/blogs/MikeDavis/ssis/559/ssis-skip-certain-files-in-a-for-each-loop 
    -Vaibhav Chaudhari

Maybe you are looking for