Access shared class in client and server

39 views
Skip to first unread message

karun kumar

unread,
Jul 12, 2012, 4:07:29 PM7/12/12
to Google Web Toolkit
Hi
 
i have class in shared package, its very simple class which has a static variable. i want to assign a value for this static variable in server class and access the same value in client class.
 
is it possible to access the value of static variable in client class, to which i modify or assign a value in server class ?
 

package

com.ca.csp.cso.project.shared;

public

class LocalisedString

{

public

static String str_value;

}

 
package com.ca.csp.cso.project.server;
 
impot com.ca.csp.cso.project.shared.LocalisedString;
 
public class SimLookUpImpl extends RemoteServiceServlet {

public

void init() throws ServletException {

super

.init();

try {

LocalisedString.str_value = "samplestring";

}

catch
(Exception e) {

}

}

}

 package com.ca.csp.cso.project.client;
 

impot com.ca.csp.cso.project.shared.LocalisedString;

public

class SimplePanel extends FlowPanel {

public SimplePanel ()

{

window.Alert(LocalisedString.str_value ); // prints null;

}

}

 

Thanks

karun

karun

unread,
Jul 17, 2012, 1:53:45 PM7/17/12
to google-we...@googlegroups.com
Hi
 
can any one guide me.
 
Thanks
karun

Jens

unread,
Jul 17, 2012, 3:55:57 PM7/17/12
to google-we...@googlegroups.com
You have to send an instance of LocalisedString from server to client. 

-- J.
Reply all
Reply to author
Forward
0 new messages