Alternate to sesssion variable

This is a question I always wanted to ask. We always read that it is better to use request object when we have to carry data from one page to other. Now let's say I have about 10 different data items that I need on 4-5 pages. Is it better to use a session variable, or is there an alternative to that? In my app I have about 10 menus where each menu performs different operations. In each such menu I have such different data which are not common between menus. Which is the best way to handle this?

If the data that you want to share on multiple pages are not related to the user or client then storing data in the session is not the ideal way because when session is destroyed the data is destroyed and you have to fetch the data again with the new session so store the data in the servlet context object . context will not be destroyed until you shut down the application so one time fetch will be enough. If the data is related to the client or user then the better option is session.
cookies will not work if the browser settings are made not to use cookies. large data transmission through cookies is not a good thing to do.

Similar Messages

  • Alternate For Global Variables.

    I am working on Forms6i in Payroll System.
    I have around 300 common global variables in my Module. When I switch over from one form to another, The variables stored in the previous Form are replaced by the new Form.
    When I Come back to oldone form. I have faced Errors. How can I Solve This problem ?
    I tried by using Local Parameters. It works but my forms will be bulky. I Could I solve this problem. Reply Urgently,
    Thanks For Co-ordination.

    Hi,
    What u can do is have Package Variables.
    These Pkg can be created on the Oracle Server and can be used by the form.
    U'r case of Global variable is unique.
    Regards,
    Ganesh R
    null

  • Compare data record to session variable

    I am completely stumped. It should be easy.
    I am trying to compare a field from a database to a sesssion variable on a JSP page and even though the fields print out the same when I call them in JSP, my "If" statement never gets activated.
    Here's the last version of the code I tried:
    String usernamev = UserSession.getValue("username").toString();
    String custname = RS.getString("ORCUST");
    if (usernamev.equals(custname))
    userrole="Customer ";
    I've also tried this:
    String usernamev = UserSession.getValue("username").toString();
    String custname = RS.getString("ORCUST").toString;
    if (usernamev.equals(custname))
    userrole="Customer ";
    And I've also tried this:
    if (RS.getString("ORCUST").equals(usernamev))
    userrole= "Customer ";
    And This:
    And I've also tried this:
    if (usernamev.equals(RS.getString("ORCUST")))
    userrole= "Customer ";
    When RILLI is the field I'm trying to compare this works:
    if (usernamev.equals("RILLI"))
    userrole= "Customer ";
    Somehow my data type must be wrong but I can't figure out why. When I print out
    <%=usernamev%>
    and <%=RS.getString("ORCUST")%>
    they show on my webpage as RILLI. I can also assign a constant value to userrole without a problem.
    What the heck am I doing wrong?

    I think limeybrit was on the right track and I hadn't trimmed because I got a no trim method error before because I hadn't converted session variable to a string.
    When I used this:
    String usernamev = UserSession.getValue("username").toString();
    usernamev = usernamev.trim();
    String custname = RS.getString("ORCUST").trim();
    I think its working now. Thanks for help all.

  • FLEX & Session Variables: a BUG?.

    TARGET:
    Calling a Coldfusion Component with Remote Object to achieve
    a boolean value as result.
    If I declare the session variable inside the CF Function it
    works.
    If I declare the session variable before the CF Function was
    called it fails.
    See this test:
    A Coldfusion page (index.cfm) that defines a sesssion variable
    to start with:
    <!--- SHOW SESSION VARIABLES AND LOAD FLEX SWF IF "sesVAR"
    IS DEFINED, OTHERWISE DEFINE sesVar FIRST --->
    <cfif isDefined('session.sesVar')>
    <cfinclude template="index.html">
    <cfelse>
    <cfset session.sesVAR = "true">
    <cfinclude template="index.html">
    </cfif>
    COLDFUSION COMPONENT (CFComp.cfc):
    <!--- CHECK SESSION VARIABLE AND RETURN "TRUE" IF EXISTS
    --->
    <cffunction name="returnBoolean" access="public"
    returntype="boolean">
    <!--- UNCOMMENT FOLLOWING LINE AND EVERYTHING WORKS FINE
    --->
    <!---<cfset session.sesVar = 'yes'>--->
    <cfif isDefined('session.sesVar')>
    <cfset resultVal = TRUE>
    <cfelse>
    <cfset resultVal = FALSE>
    </cfif>
    <cfreturn resultVal>
    </cffunction>
    FLEX:

    "drongo79" wrote:
    > Oh well sorted it out myself anyway.
    Do you want to share, please?

  • Base unit of measure is cahnging after creation of material master

    Hi
    I have created a material with material type Raw material with BUM  "Ton" , after save the material, when iam checking the material with display mode, the BUM is changed into "EA",i dont know where the sustem picks the BUM as "EA", kindly suggest where i have to do the configuration settings.
    Thanks

    Hi,
    Have you created the New Material referencing from another material.
    Please check the following links for details. It should be able to answer your queries.
    [Re: can't able to change into alternate UOM]
    [Re: variable order unit]
    [Re: Base Unit of Measure]
    Hope it helps,
    Best regards
    Amit Bakshi
    Edited by: AMIT BAKSHI on Aug 4, 2011 12:44 PM

  • Loading XML problem with spry

    I have a php page that creates a recordset from mySQL and the exports it as XML so I can load it into dreamweaver to use with spry
    this particular recordset filters the results according to a session variable, so the results are relevant to the logged in user
    in dreamweaver the XML will not load though, as I assume this is because dreamweaver does not have a session with the server, so the required session variable does not exist.  the page access is also restricted (needs a user to have logged in tot he site thus creating the session)
    how can I set the sesssion variable in dreamweaver so when it requests the XML is will load
    hope that makes sense

    If you talking about seeing the SPRY XML in the Bindings panel, then Dreamweaver cannot set a Session Variable to my knowledge.
    What I do is use a Default Value in my SQL statement to guarantee it returns a recordset.
    Hope this helps.

  • [php+mysql] how to pass data from one insert form to another?

    Hi all,
    I have an insert form (in a mysql db) on the page. Is there a way to
    view the inserted data after inserting so stat the user can print it
    out?
    TIA
    tony

    >Hi Tony,
    >let´s assume the table´s Primary Key column is named "id" -- just add this value (available as "Dynamic Data") to the "Redirect after Insert" URL in the following way:
    >print.php?id={id}
    >...and on that page add a recordset which queries the table like that:
    >"SELECT * FROM tablename WHERE id" equals the URL parameter "id"
    >That should be all there is to do.
    >Cheers,
    >Günter Schenk
    >Adobe Community Expert, Dreamweaver
    Hi Günter,
    Thanks, it works.
    I added a bit of code to set a session variable using this Parameter
    URL, so that I can manage the record ID along the whole user session.
    So, I ask you a little question: when it is best to delete or destroy
    session variables? after displaying the inserted records or just befor
    inserting the first one?
    Here is my little test workflow:
    1- destroy variable sessions (I think I will unset session variables
    one by one instead, to eliminate the risk to delete other sesssion
    variable (UserID...)
    2- insert the first record (redirect to the next page using the record
    ID1)
    3- set a session variable (S1) using the ID1 coming from previous page
    ($_GET)
    4- insert the second record (redirect to the next page using the
    record ID2)
    5- set a session variable (S2) using the ID2 coming from previous
    page ($_GET)
    6- insert the third record (redirect to the next page using the
    record ID3)
    7- set a session variable (S3) using the ID3 coming from previous page
    ($_GET)
    8- create a recordsets to filter the db by S1, S2 and S3.
    9- display the report
    it seems to work.
    do you think there is something to refine?
    Thanks again for your kindness.
    tony

  • User Management - Configuring through code

    Create a session variable in the datasyn project. In a filter we will set a sesssion variable, the value of the session variable will be an array of strings. Each element of the array will contain the groups associated to the user. In Portal admin tool we have to configure to do entitlements from this session variable.
    Does anyone have any idea how to configure the entitlements in portal admin console thorugh a session variable?
    Please let me know if this approach of configuring user management through code is feasible?
    Thanks,
    Sid
    Edited by: user10869789 on Jul 23, 2009 10:54 AM

    Just in case you missed it , if the condition is always based on the user's groups then you need not use session property set , you can directly use 'Add Groups to Role' when you are editing the visitor entitlement
    As a rule i would tend to avoid putting things in the session unless there was no other way. (in your case , everytime the user's group changes the session must be updated , it also means that changing the groups through any external means e.g. directly updating say the user ldap would not reflect in the users current session -- unless you wrote more code)
    The benefit of using the session would be that this need not be directly mapped to a group , it can be anything you want.
    regards
    deepak

  • Field not hiding upon changing screen no of infotype

    Hi SAP Gurus,
    I've an issue for which i need your expert opinion.
    I am working on international environment and my issue is that I have to change screen no in table V_T582A Infotype Attributes. Lets say i've changed the standard screen 2000 to 2006 because the screen was not bringing the exact entry date even after maintaining ENTRY feature. Therefore I had to go for Screen 2006. In table V_T588M I have chosen the module pool for IT0016 and in the alternate screen with variable key 12 I have selected certain fields to be hidden and also i had changed the feature P0016 even accordingly where i had mentioned the variable key 12 to be used for country grouping 99.
    After performing all the above configuration steps, i am still unable to hide any field.
    Kindly help me. Your help will be really appreciated.
    Thanks,
    Irfan Malik
    SAP HR Consultant
    SIEMENS Eng. Co. Ltd. Pakistan

    Hi Naim,
    Basically the data in Infotype in which you are changing the record doesn't exist.
    That is the reason you are receiving the message in RETURN " NO DATA STORED FOR 0003 FOR SELECTED PERIOD"
    If you want to see online where exactly the problem lies....Just put the Break point and also dialog_mode in FM as "<b>1"</b>
    CALL FUNCTION 'HR_INFOTYPE_OPERATION'
    EXPORTING
    INFTY = '0003'
    NUMBER = PERNR
    VALIDITYEND = i0001-BEGDA
    VALIDITYBEGIN = i0001-ENDDA
    RECORD = i0001
    OPERATION = 'MOD'
    TCLAS = 'A'
    DIALOG_MODE = '<b>1</b>'
    NOCOMMIT = 'X'
    IMPORTING
    RETURN = I_RETURN
    Reward Points for helpful answers.
    Thanks.
    hari krishna.

  • Variable for Alternate Unit of Measure

    Hello Experts
    I have implemented the soultion for reporting data in Alternate Unit of measure using the "How to..." guide provided at https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/b7b2aa90-0201-0010-a480-a755eeb82b6f
    This solution involves creating a variable which prompts the user to enter the required unit of measure.
    However I have a situation where I would like to create variable which is not input-ready and has a fixed value assigned to it without prompting the user. Moreover, I cannot modify the already existing input-ready variable as it is used in other Queries.
    Does this involves creating a new user exit or modifying the existing user exit. If yes then can you please tell me how this can be done.
    Thanks
    Rishi

    Hi Rishi,
    You can follow any one the below procedure for solve your issue.
    1. You can change the variable by removing the check box "Ready to input". But you mentioned that you used that variable in other queries also. So, I am not suggesting this.
    2. You create a new variable same as the existing variable but with out selecting "Ready to Input" check box. Now when the user run the query, that variable will not be seen to the user. Now, we will see the customer exit, you assign new variable value to existing variable, before that you have to write a condition for checking the query name. If you are running the query which have the new variable then assign the variable value to old variable. This will solve your question.
    I hope you understood this procedure. If you have any doubts let me know.
    Regards,
    Patil.

  • Variable issue for Alternate Unit of Measure

    Hello Experts
    I have implemented the soultion for reporting data in Alternate Unit of measure using the "How to..." guide provided at https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/b7b2aa90-0201-0010-a480-a755eeb82b6f
    This solution involves creating a variable which prompts the user to enter the required unit of measure.
    However I have a situation where I would like to create variable which is not input-ready and has a fixed value assigned to it without prompting the user. Moreover, I cannot modify the already existing input-ready variable as it is used in other Queries.
    Does this involves creating a new user exit or modifying the existing user exit. If yes then can you please tell me how this can be done.
    Thanks
    Rishi

    Hi Rishi,
    You can follow any one the below procedure for solve your issue.
    1. You can change the variable by removing the check box "Ready to input". But you mentioned that you used that variable in other queries also. So, I am not suggesting this.
    2. You create a new variable same as the existing variable but with out selecting "Ready to Input" check box. Now when the user run the query, that variable will not be seen to the user. Now, we will see the customer exit, you assign new variable value to existing variable, before that you have to write a condition for checking the query name. If you are running the query which have the new variable then assign the variable value to old variable. This will solve your question.
    I hope you understood this procedure. If you have any doubts let me know.
    Regards,
    Patil.

  • Query- Variable Alternate Unit

    Friends,
    I searched sdn and googled also.
    I am unable to find my solution. Pls help.
    My requirement is to find out Prod. Qty in alternate Unit of measure for different materials each have got different alternate unit .
    For eg. If a material is having alternate units as CAP, and EA. I need Prod. Qty in Both this alternate Units.
    For Fixed alternate unit it works fine, but for variable(more than one) I donno how to do.
    Kindly help.
    Regards,
    Guru

    Thanks for ur time Amer,
    Is it possible in Query level? I had loaded the alt UOM in Unit of Measure for Char in Business Explorer tab of 0material.
    And Sap has created the automatic DSO, with all numerator, denominator etc..
    I know the procedure for creating a variable screen for alt UOM. and it allows me only to select one alternate unit. I donno how to do for multiple alt unit.
    Can you pls explain a bit more elaborate. I am just 1 month old to BI.
    Thanks,
    Guru

  • Alternate method to writing filter for recordset using session variable

    I'm not sure if this can be done.  I have a user page which I'd like to return database info based upon a userid entered on another page. So far, the session variable (userid) is captured on the user page however it is supposed to return the user's name rather than displaying the session variable.
    My problem is this. Within dreamweaver, I am able to create recordsets however I cannot create a filter. The connection works. At this point, I am searching for a workaround where I can tie in the session variable to recordsets. I should make mention that whenever I update the sql statement using the recordset widget, my recordset disappears. ?  At any rate, heres a sample of the code sans connection strings, etc.
    <%
    Dim Recordset1
    Dim Recordset1_cmd
    Dim Recordset1_numRows
    Set Recordset1_cmd = Server.CreateObject ("ADODB.Command")
    Recordset1_cmd.ActiveConnection = MM_newuniversity1_STRING
    Recordset1_cmd.CommandText = "SELECT name FROM table WHERE userid =  '" & Session("userid_my") & "'"
    Recordset1_cmd.Prepared = true
    Set Recordset1 = Recordset1_cmd.Execute
    Recordset1_numRows = 0
    %>
    On the user page, I have a 'Welcome' and the following code
    {Request.userid_my}
    Any suggestions? I'm afraid I'm a newbie to asp within dreamweaver cs3.

    >When I insert  request.userid_my code it returns the session variable
    AFAIK, session variables are not part of the request object - so I do not understand why you are referencing them this way. I would use the standard reference method : Welcome <%Response.Write(Session("username"))%>
    >when I insert the recordset associated with 'name' I get an Adobe End of file error. ?
    Sounds like a possible problem with your installation. You may need to try reinstalling DW. How are you "inserting" this recordset and when does the error occur?
    Regarding your next post...
    >select name from table_name where userid = '" & namemy & "'"
    >The statement consistently returns a 'quoted string not properly terminated' error.....
    The select statement you quoted is obviously not complete. If you are refering to the select in your OP:
    Recordset1_cmd.CommandText = "SELECT name FROM table WHERE userid =  '" & Session("userid_my") & "'"
    I see nothing wrong with that syntax and the string appears to be terminated correctly. If there is a different statement causing the error, please post the entire line and include a line above and below.

  • Problem with Threads and a static variable

    I have a problem with the code below. I am yet to make sure that I understand the problem. Correct me if I am wrong please.
    Code functionality:
    A timer calls SetState every second. It sets the state and sets boolean variable "changed" to true. Then notifies a main process thread to check if the state changed to send a message.
    The problem as far I understand is:
    Assume the timer Thread calls SetState twice before the main process Thread runs. As a result, "changed" is set to true twice. However, since the main process is blocked twice during the two calls to SetState, when it runs it would have the two SetState timer threads blocked on its synchronized body. It will pass the first one, send the message and set "changed" to false since it was true. Now, it will pass the second thread, but here is the problem, "changed" is already set to false. As a result, it won't send the message even though it is supposed to.
    Would you please let me know if my understanding is correct? If so, what would you propose to resolve the problem? Should I call wait some other or should I notify in a different way?
    Thanks,
    B.D.
    Code:
    private static volatile boolean bChanged = false;
    private static Thread objMainProcess;
       protected static void Init(){
            objMainProcess = new Thread() {
                public void run() {
                    while( objMainProcess == Thread.currentThread() ) {
                       GetState();
            objMainProcess.setDaemon( true );
            objMainProcess.start();
        public static void initStatusTimer(){
            if(objTimer == null)
                 objTimer = new javax.swing.Timer( 1000, new java.awt.event.ActionListener(){
                    public void actionPerformed( java.awt.event.ActionEvent evt){
                              SetState();
        private static void SetState(){
            if( objMainProcess == null ) return;
            synchronized( objMainProcess ) {
                bChanged = true;
                try{
                    objMainProcess.notify();
                }catch( IllegalMonitorStateException e ) {}
        private static boolean GetState() {
            if( objMainProcess == null ) return false;
            synchronized( objMainProcess ) {
                if( bChanged) {
                    SendMessage();
                    bChanged = false;
                    return true;
                try {
                    objMainProcess.wait();
                }catch( InterruptedException e ) {}
                return false;
        }

    Thanks DrClap for your reply. Everything you said is right. It is not easy to make them alternate since SetState() could be called from different places where the state could be anything else but a status message. Like a GREETING message for example. It is a handshaking message but not a status message.
    Again as you said, There is a reason I can't call sendMessage() inside setState().
    The only way I was able to do it is by having a counter of the number of notifies that have been called. Every time notify() is called a counter is incremented. Now instead of just checking if "changed" flag is true, I also check if notify counter is greater than zero. If both true, I send the message. If "changed" flag is false, I check again if the notify counter is greater than zero, I send the message. This way it works, but it is kind of a patch than a good design fix. I am yet to find a good solution.
    Thanks,
    B.D.

  • Assigning value to array type variable in a loop

    Hi
    I have a scenario in which i am assigning value from a array type variable(x) to the invoke variable of a database adapter. The variable x is exact replica of the invoke variable.
    My copy operation in assign activity looks like this-
    <copy>
    <from variable="Var" part="InputParameters"
    query="/ns7:InputParameters"/>
    <to variable="Invoke_call_XXDPI_EDI_852_PKG_InputVariable"
    part="InputParameters"
    query="/ns7:InputParameters *(* bpws:getVariableData('iterator') *)* "/>
    </copy>
    It is inside a while loop activity.
    PS *()* are square brackets
    But it is erroring out at run time.
    Does anybody has an alternate idea to assign value to an array type?.
    i have seen that while extracting value from an array type variable it works fine
    A similar kind of operation is shown below.
    <copy>
    <from variable="Var" part="InputParameters"
    query="/ns7:InputParameters *(* bpws:getVariableData('iterator') *)* "/>
    <to variable="Invoke_call_XXDPI_EDI_852_PKG_InputVariable"
    part="InputParameters"
    query="/ns7:InputParameters"/>
    </copy>
    Thanks
    Ayush
    Edited by: Ayush fujitsu on Aug 14, 2009 4:36 AM

    Hi Ayush
    I suppose you are getting some error like "source node returns multiple elements".
    In second case there is no problem because you are assigning *InputParameters[bpws:getVariableData('iterator')]* (+suppose InputParameters[1]+) to target. Here it works fine because you are fetching oonly 1 value from source and assigning it to the target.
    Now in first case you are saying copy InputParameters to target[1] suppose. You know that source is an array which contains multiple index so which index field from the source will be assigned to the target.
    Try your process with only 1 source value it will work but when multiple values will be there it will fail. You have to merge both the cases and it will look like
    *<copy>*
    *<from variable="Var" part="InputParameters"*
    query="/ns7:InputParameters ( bpws:getVariableData('iterator') ) "/>
    *<to variable="Invoke_call_XXDPI_EDI_852_PKG_InputVariable"*
    part="InputParameters"
    query="/ns7:InputParameters ( bpws:getVariableData('iterator') ) "/>
    *</copy>*
    And the easiest way to do this is by the transform activity as said above.
    Regards
    Suryaveer
    Edited by: Suryaveer on Aug 15, 2009 11:19 PM

Maybe you are looking for