The get and set functions are called getters and setters - they are part of
the javabean specification: http://en.wikipedia.org/wiki/JavaBean

I'm guessing the XML library you are using requires java objects to be
defined as javabeans. I've seen a couple other libraries that do that too -
not sure why they work that way.

For the bigger picture, that all depends on your server setup. If you're
just experimenting, I'd suggest using GWT with Google App Engine, and
storing data via hibernate. Google has a good tutorial for using GWT with
app engine/hibernate. I think a database is almost alwasy easier than
serializing objects to a file.

To your point about changing your data model: I've found that app engine is
really bad for this. There isn't (I don't think) a simple way to "delete all
objects of this class" out of the box. When I was just experimenting with
app engine, I found it easier to just create new class definitions than
modify existing classes.

Good luck learning GWT!
Brett

On Sat, Nov 13, 2010 at 2:38 PM, David Cox <[email protected]> wrote:

> So, i managed to solve my own problem again, but I'm no 100% on how i
> did it.
>
> What i did was remove all my functions in the class and then re-added
> them with the "create getter and setter for <private String>"
>
> Then i made sure that the variable was set using the actual setter
> function. ie: this.setTitle(Title).
> I also had other function in the class.
> Like myfucntion(String title, int counter) or something like that.
> Origionaly i have stuff like
> this.Title = title.
>
> I had to change these to this.setTitle(title). Even though all the
> setTitle function does exaclty: this.title = title.
> For some reason this fixes it.
>
> as far as i can tell, the rules for successful xml serialisation as as
> such:
> 1. The each variable you want serialised must have a set command
> called that has the same name with a "set" prefix
> 2. this function must be called at least once or that particular
> variable will not be searilised (once it is called though, you can
> then go back to using direct methods like this.Title = title. )
> 3. each variable MUST also have a public function wiht the same name
> and a "get" prefix.
>
> It took me ages to work this out, and i would love it if someone out
> there could explain why.
> My only guess is that it does have 1 convenient feature, and that is,
> you can actually use this to determine which variables will be seen in
> the resulting serialised XML, but you can still work happily with all
> the other variables in an object (like counters and states) and not
> have them appear in the output.
>
> Nice one. Just wish i found a tutuorial out there that explained this
> to me from the start.
>
> Am still interested to hear what others do.
>
> /David
>
> --
> You received this message because you are subscribed to the Google Groups
> "Google Web Toolkit" group.
> To post to this group, send email to [email protected].
> To unsubscribe from this group, send email to
> [email protected]<google-web-toolkit%[email protected]>
> .
> For more options, visit this group at
> http://groups.google.com/group/google-web-toolkit?hl=en.
>
>

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

Reply via email to