BobM,

See if my thoughts are right.

Assuming I've this entity class:

package myapp.entity;
public class Item {
     private int id;
     private String productName;
     private BigDecimal price;

    // getters and setters
}

This class is packaged in a file called entities.jar and because the price
attribute which is a BigDecimal I can't send this entity directly to GWT
client over RPC. Then, I need a DTO to encapsulate the values using data
types that GWT client can understand. The DTO class would be:

package myapp.client.gwt.dto;
public class *ItemDTO* {
     private int id;
     private String productName;
     private *Double* price;

    // getters and setters
}

Right? Now my service must load an Item, create the corresponding ItemDTO
and send it back to GWT client. The client changes it, send it back to ther
server, the server update the Item instance and save.

Thinking about the package and the source files. Could I create a java class
library with the package *myapp.client.gwt.dto* and use this library in
classpath for the GWT client and the server?

Thanks, for helping.

---
Felipe Marin Cypriano
Vitória - ES


On Wed, Feb 11, 2009 at 11:02 PM, BobM <bmar...@bcscomputers.com> wrote:

>
> Felipe,
>
> You can use anything on the client side that GWT supports, and that
> includes everything supported by HTML and javaScript, you can use
> anything on the server side that java allows.  You would likely
> communicate from client side to server side using GWT RPC mechanisms.
> by which you can ship across - back and forth - anything that is
> serializable ... which includes java primitives and most java classes,
> especially including - I think - all of the collections classes.  So,
> there are many options available to you to communicate between client
> side and server side.
>
> With regard to BigDecimal ... no such thing exists in javaScript.
> Indeed, virtually all significant math in javaScript uses floating
> point and therefore significant calulations are prone to normal
> floating point rounding errors.  On the other hand, the common
> representation of values on any browser side presentation is ascii.
> You can ship a big ascii number across to the server side and convert
> it there to BigDecimal, if that is what you wish to use in your java
> server side code.
>
> Just a few ideas for you.
>
> Best regards.
>
> On Feb 11, 12:51 pm, Felipe Cypriano <fmcypri...@gmail.com> wrote:
> > Hello,
> >
> > I'm studying the usage of GWT in the next version of our app. I've read
> the
> > FAQ and some classes aren't support on client side, such as BigDecimal
> which
> > is used extensively in our entities classes.
> >
> > So, what do you thinks is the best way to do the comunication between
> client
> > and server and reuse as much as possible all the entities?
> >
> > I read the article Security for GWT
> > Application<
> http://groups.google.com/group/Google-Web-Toolkit/web/security-for-gw..
> .>and
> > change my mind about using JSON to transfer the data. Looking for
> > another ways I read about using DTO pattern, but how do I do this? Some
> > tips? Links?
> >
> > Regards,
> >
> > ---
> > Felipe Marin Cypriano
> > Vitória - ES
> >
>

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Google Web Toolkit" group.
To post to this group, send email to Google-Web-Toolkit@googlegroups.com
To unsubscribe from this group, send email to 
google-web-toolkit+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/Google-Web-Toolkit?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to