|
Re: Is there a way to tell server side code from client side code? [message #526831 is a reply to message #526806] |
Tue, 13 April 2010 07:39 |
|
Hi Wane,
wayne wrote:
> Hi Friends,
> Could someone tell me how to differentiate server side code from client
> side code in a RAP project?
Server-side code is Java, client-side code is Javascript. None of your
code is ever pushed onto the client, if that's what you mean. You don't
have to deal with client-side code unless you write custom widgets.
> I put some code in Application, which is responsible for loading
> reference data from DB. The data are stored in static HashMaps. My
> original thought is that these data will be used by different users, but
> I found it's not. Every time when a new web browser opens the data is
> accumulated, namely same data is loaded into same HashMaps, that is an
> error. How could that be?
> Is it just that because I use static maps?
Every user gets his own Application instance. If you want to initialize
these HashMaps only once, do it in a static initializer block or use
lazy loading. Note that with lazy loading or if there's any write access
to the maps, you need synchronization.
Best regards, Ralf
|
|
|
|
Re: Is there a way to tell server side code from client side code? [message #526892 is a reply to message #526850] |
Tue, 13 April 2010 12:01 |
|
wayne wrote:
> But why "static" is shared by different newly opened web page, not in
> different session?
Not sure if I understand your question. A newly opened web page does
result in a new session. Static fields are bound to the class, which is
loaded only once.
If this doesn't answer your question, please describe your problem more
precisely.
Ralf
|
|
|
|
Re: Is there a way to tell server side code from client side code? [message #527683 is a reply to message #527663] |
Fri, 16 April 2010 06:38 |
Benjamin Wolff Messages: 137 Registered: July 2009 |
Senior Member |
|
|
Hi,
this is not a RAP issue, actually it is a SWT issue.
http://www.eclipse.org/swt/faq.php#uithread
Greetings,
-ben
Am 16.04.2010 04:46, schrieb wayne:
> By static I mean, if you define a static field in a class, and open a
> web page to access it, and close it, then open another to access it, you
> will be notifiied with an error "invalide thread access". I don't know why.
|
|
|
|
Powered by
FUDForum. Page generated in 0.02939 seconds