Hi Jack!
Basically, everything you need is explained here:
http://code.google.com/docreader/#p=google-web-toolkit-doc-1-5&s=google-web-toolkit-doc-1-5&t=DevGuideRemoteProcedureCalls

All you need to do, is:
- define some method in your service interface (MyService extends
RemoteService), eg. void sendItToServer(String msg);
- implement it on the server side (MyServiceImpl extends
RemoteServiceServlet implements MyService);
- create async interface (MyServiceAsync) with method void
sendItToServer(String msg, AsyncCallback callback);
- add <servlet> definition to your module.xml file, like: <servlet
path="/myService" class="com.example.foo.server.MyServiceImpl" />
- call it from client:
MyServiceAsync service = (MyServiceAsync) GWT.create(MyService.class);
((ServiceDefTarget) service).setServiceEntryPoint(GWT.getModuleBaseURL
() + "myService");
service.sendItToServer("hello world!", = new AsyncCallback() {
    public void onSuccess(Void result) {
      // do some UI stuff to show success
    }

    public void onFailure(Throwable caught) {
      // do some UI stuff to show failure
    }
  };

and it's done.
I hope, I helped and didn't made any mistake, but if so, please
correct me.
Sorry for my bad english (:


On Dec 18, 9:43 pm, "fatjack1...@googlemail.com"
<fatjack1...@googlemail.com> wrote:
> Ok, thanks for your response but how do you physically pass the
> variable back to the server. Is there some sort of method I need to
> write in the client?
>
> I know this is probably really simple but im struggling.
>
> Cheers,
> Jack
>
> On Dec 17, 3:24 pm, "Isaac Truett" <itru...@gmail.com> wrote:
>
> > Just add a parameter to the GWT RPC service method. Like this
> > (assuming GWT 1.5):
>
> > public interface MyRpc extends RemoteService {
> >   String doStuff(String arg);
>
> > }
>
> > public interface MyRpcAsync {
> >   void doStuff(String arg, AsyncCallback<String> callback);
>
> > }
>
> > On Wed, Dec 17, 2008 at 10:17 AM, fatjack1...@googlemail.com
>
> > <fatjack1...@googlemail.com> wrote:
>
> > > Hi,
>
> > > I wonder if anyone can help me. I am new to GWT so am still trying to
> > > get my head round how everything works...
>
> > > So basically I have my server set up. It can send data to the client
> > > using an AsyncCallback etc. Now I need the client to send something
> > > back to the server. For example, if the user selects something from a
> > > drop down menu I want that value to be sent to the server as a
> > > variable, the server to retrive some data from the database and then
> > > send it back to the client. I cant work out how to send the variable
> > > to the server. I'm sure its simple enough but would someone be able to
> > > explain to me how to do this? And if not point me to some
> > > documentation which would talk me through it?
>
> > > Thanks for your help in advance,
> > > Jack

--~--~---------~--~----~------------~-------~--~----~
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