cancel
Showing results for 
Search instead for 
Did you mean: 

How to share a class static attribute between two component/session ?

Former Member
0 Kudos

In one package, there are two component - cp1, cp2, and a class cl_test with a private static attribute val and static method set/get for the static attribute.

Now I want to share this static attribute between the two component. Since they are in different session.Is there any way to make the static attribute shared?

Thanks a lot

Accepted Solutions (1)

Accepted Solutions (1)

thomas_jung
Developer Advocate
Developer Advocate
0 Kudos

>Since they are in different session.

What do you mean by different sessions? Static attributes have a lifetime across the entire user session. So if you have mulitple component usages - or you perform navigation from one component to another, the static attribute will persist. However if you in fact have different user sessions, they can't share the static attribute. For sharing across user sessions, you should consider shared memory objects or writting of the data into the database (for instance via Server Cookies).

Former Member
0 Kudos

Thanks. Shared memory object may help to do data transferring between different sessions.

Answers (1)

Answers (1)

Former Member
0 Kudos

Is your get/set method public, if yes then you can access this static attr using these methods.

Regards

Manas Dua

Former Member
0 Kudos

Set/Get are both public, I can use them to access the static attribute. However, I want both web dynpro component to share the value of static attribute and, if one modify its value, the other comp. can get the new value.

Thanks.