• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Not able to access value set by one GWT module in another module.

 
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
There are 2 GWT module with respective entry points and host page : Module A and Module B.
There is one common module with no entry point : Module C.
Module A sets a string value in Module C, say moduleC.setName("xyz").
Module B wants to get the value. say moduleC.getName();
On doing above the value Module B is getting is always null not the value set by module A.

Common module is packaged as jar and inherited in other two modules. what am I doing wrong?
 
Bartender
Posts: 11497
19
Android Google Web Toolkit Mac Eclipse IDE Ubuntu Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Common module is packaged as jar and inherited in other two modules. what am I doing wrong?


So do A and B share the same jar for module C or do they have their own copy?
 
aditi singh
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
They have own copy of module C.
Module A includes common.jar in its build.xml and inherts common in gwt.xml file.
Similar is the case for moduleB.
How can I make both these module access the update field in common?
 
Maneesh Godbole
Bartender
Posts: 11497
19
Android Google Web Toolkit Mac Eclipse IDE Ubuntu Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

They have own copy of module C.


So when you say C.setValue from A, A's copy of C is getting the value to reset. You need to call C.setValue on B's copy of C
 
aditi singh
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
how do I do that?
do I need to inherit module B in A tom access to module B's copy for C?
 
Maneesh Godbole
Bartender
Posts: 11497
19
Android Google Web Toolkit Mac Eclipse IDE Ubuntu Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Easiest would be expose a servlet on B which can be accessed by A to make a POST call with the new value
 
aditi singh
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
is there any other way of accessing values for cross communication between GWT modules.
or should the value be set somewhere else that is accesble by all modules?
 
Maneesh Godbole
Bartender
Posts: 11497
19
Android Google Web Toolkit Mac Eclipse IDE Ubuntu Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Are your modules hosted on the same server? If yes, you can consider an approach where the module would persist the value in some shared location. But you lose this facility if you host them across different servers. Thats why I suggested the servlet approach.
 
Maneesh Godbole
Bartender
Posts: 11497
19
Android Google Web Toolkit Mac Eclipse IDE Ubuntu Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You might also find this useful http://stackoverflow.com/questions/17273572/how-to-communicate-two-module-in-gwt which recommends the JS approach with certain conditions
 
aditi singh
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
apart from that, is there any way that A and B share the same copy of common?
 
Maneesh Godbole
Bartender
Posts: 11497
19
Android Google Web Toolkit Mac Eclipse IDE Ubuntu Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You keep asking for alternatives. Maybe it's time you explained what is wrong with the suggestions you have received till now
 
aditi singh
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
alright, servlet option is not suitable for us as we are not using a java container on web server (it is in place to route the async call to c++ backend).
JSNI is suitable but looks like javascript window obj has limitation on size of the data to be accessed. (I might go wrong here)
Hence, I asked for an approach where 2 GWT modules can share the same copy of common. This question clicked me from your 1st question "So do A and B share the same jar for module C or do they have their own copy? "
 
Maneesh Godbole
Bartender
Posts: 11497
19
Android Google Web Toolkit Mac Eclipse IDE Ubuntu Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
No java container? What are you using then?
You still havent told us

Maneesh Godbole wrote:Are your modules hosted on the same server?

 
aditi singh
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
yes they are on same server
 
Maneesh Godbole
Bartender
Posts: 11497
19
Android Google Web Toolkit Mac Eclipse IDE Ubuntu Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
If you cannot be bothered to fully share the information we might need to help solve your problem, I doubt anyone will be willing to spend much volunteer time over it.
 
reply
    Bookmark Topic Watch Topic
  • New Topic