2

I am using two sessions namely CCXSession and Session in my sample web object application project, here Session class is inherited from CCXSession.

For the purpose of localization I need to send the session object from Session to CCXSession, but I failed in achieving this.

I need a confirmation on below points:

  1. Is it possible to send session values from one session to another?
  2. if yes how is it possible?

and the code is:

public String getDisplayAppName() {
    String retVal = null;
    retVal = (String)((CCXSession)session())
                .localizer()
                .valueForKey(
                    currentApp
                    .applicationLink()
                    .deployAppName()
                    .displayAppName()
                );
     return retVal;
}

here I am passing the key value to valueForKey();

Can anybody help me in this issue.

srk
  • 4,857
  • 12
  • 65
  • 109
fresher
  • 127
  • 11
  • localization means translating a word or sentence to different languages – fresher Mar 15 '13 at 11:25
  • is this session class serializable..?? have you tried serializing the session object and sending it through..?? also i am assuming that the class CCXSession is a custom class. if not please provide jar name or complete class name and check its java doc.. – Fr_nkenstien Mar 15 '13 at 11:33
  • no its not vineet,and clearly saying we are using two frames one for the dashboard(For displaying the application name) and another for appliation.we are using CCXSession for dash board and Session for application. – fresher Mar 15 '13 at 12:03
  • i need to localize the data present in the dash board – fresher Mar 15 '13 at 12:19

1 Answers1

1

As per my Java EE concepts, session values can only be transferred via request and until and unless u are passing requests between the 2 variables, you have very few options left.

out of these options you can try the following:

  • Use Application context and set it at run time and retrieve it accordingly
  • or you could use some static class with singleton pattern to pass the value to the value. since the application is in the same code base, thus let other classes access the value from ccxsession and set it in the session class.
  • You could use DB tables to store and retrieve data as needed. but this will be a performance drawback
  • lastly if possible you could look into web services which will be the worst case scenario to pursue since both sessions are in same applications.

as per me the first 2 options should work for you

Arjan Tijms
  • 37,782
  • 12
  • 108
  • 140
Fr_nkenstien
  • 1,923
  • 7
  • 33
  • 66