EXT GWT + java EE

My question is: what is the best way to send data to the Java EE beans annotated entity 'client can use it in a grid, for example? Of course, I could manually create BaseModel client models for each object, but I wonder what might be best here. I need a walkthrough if possible.

+4
source share
3 answers

I have been using ext-gwt (gxt) for about a year and I feel your pain!

From what I have learned so far, it seems that there are 3 strategies for transferring beans between the client and server:

Here is an overview of each strategy:

  • Create a client pojo / bean that extends the BaseModel for each server-side object bean / pojo / entity bean.
  • Share pojo / bean between client and server
  • Convert the server side of pojo / beans to json before sending it to the client and then use Javascript (json) objects on the client side.

Of course, there are compromises for everyone.

Strategy # 1 integrates nicely into gxt. You can use gxt built into stores and bindings. This is the strategy that I used in the production application, and it worked, but I found it tedious to duplicate beans on the client and server. Personally, I also found that the extjs (and gxt) storage / binding mechanism can be overly complex and complicated for short cases.

Strategy No. 2:. This is the strategy that I will most likely use in my next gxt project. The downside is that you have to make your own form and mesh binding in gxt on the client. But at the top you can share all your beans / pojos. Here is a brief overview of implementation details:

In the server-side src tree, add the .gwt.xml file to the root package containing the pojo / bean server classes. For example: I created this file named "gwt-models.gwt.xml" in com.daveparoulek.gwt.server.models

<module rename-to='gwt-models'> <inherits name='com.google.gwt.user.User' /> <source path="client" /> </module> 

In the above example, the beans are actually located inside com.daveparoulek.gwt.server.models.client.

After you configure this setting, you can configure the gwt client project to include the src code inside com.daveparoulek.gwt.server.models by adding the gwt client project "inherit" project to your gwt.xml file, for example:

 <inherits name="com.daveparoulek.gwt.server.models" /> 

Strategy # 3: After watching a few conversations with google on gwt, this seems to be their preferred way of working with objects on the client side. Although this leads to the creation of a json overlay type for each server side of the pojo / bean. It also doesn't fit perfectly in the gxt world. Click here for a very good introduction to this concept.

+3
source

I am not a specialist, but it seems that people use Gilead (which has a tutorial) + GWT + GXT to facilitate the process.

0
source

BeanModelFactory is a huge waste of your time. According to Sencha help docs , you can simply call getFactory on what BeanModelFactory returns from a call to the static get() method. Following their example, this return value is an instance of the BeanModelFactory class itself, which has an unrealized (abstract) getFactory() method.

So you get a good null pointer out of nowhere. Thanks for this.

I would stick to strategy number 1.

0
source

All Articles