Next you need to have server side class something like this:

-----
package com.company.server.gwt;
public class TeacherServiceImpl extends RemoteServiceServlet
implements TeacherService
{
       private static final long serialVersionUID = 1L;

        public List<PupilDTO> getPupils(Integer teacherId)
        {
                List<PupilDTO> results = performYourServerSideAction();
                return results;
        }

}


---

Then in your GWT.xml file you need to link the server to the client
with servlet mappings like so:

<servlet path="/teachers"
class="com.company.server.gwt.TeacherServiceImpl"/>

Notice I use /teachers to map to my server side class.

Thats pretty much it. Your DB code that you have already shown us
should go on the server side either in your ServiceImpl class or
another server side bean (preferred)



On Apr 8, 3:36 pm, eggsy <[email protected]> wrote:
> Are you using GWT 1.4 or 1.5?
>
> If you are using 1.5 add the line:
>
> @RemoteServiceRelativePath("teachers")
>
> in the same place as where I have mine - replace teachers with
> whatever path you want for your servlet.
>
> next thing is how to call the servlet using RPC this should be done
> like so:
>
> TeacherServiceAsync teacherService = (TeacherServiceAsync) GWT.create
> (TeacherService.class);
>
> teacherService.getPupils(teacherId, new AsyncCallback<List<PupilDTO>>
> ()
> {
>
>     public void onFailure(Throwable caught)
>     {
>         // TODO Auto-generated method stub
>
>     }
>
>     public void onSuccess(List<PupilDTO> result)
>     {
>         // TODO         Do something with the result
>     }
>
>  });
>
> ----
>
> You can see how my client side code matches up now - is this making
> sense so far and do you have something similar? This is how GWT RPC
> should be implemented client side.
>
> On Apr 8, 1:44 pm, Cryssyenddo <[email protected]> wrote:
>
> > package vCarePortal.client;
>
> > import java.sql.Date;
>
> > import com.google.gwt.user.client.rpc.RemoteService;
>
> > public interface DiscussionBoardService extends RemoteService {
>
> >         public Forum[] getForums(int forumAccessLevel);
>
> >         public Topic[] getTopics(int forumID, int topicAccessLevel);
>
> >         public Thread[] getThreads(int topicID, int threadAccessLevel);
>
> >         public ThreadReply[] getDiscussionPosts(int threadID);
>
> >         public Contributor getUser(String password, String userID);
>
> >         public int countThreads(int topicID);
>
> >         public int countThreadReplies(int threadID);
>
> >         public String[] getLatestThreadReply (int threadID);
>
> >         public String getImageURL (String imageID);
>
> >         public void createForum(String forumName, String forumDescription,
> > String userID, int accessLevel);
>
> >         public void modifyForum (int forumID, String forumName, String
> > forumDescription, int accessLevel);
>
> >         public void deteleForum (int forumID);
>
> >         public void createTopic (String topicTitle, String topicDescription,
> > int topicAccessLevel, String creatorID, int forumID);
>
> >         public void modifyTopic(int topicID, String topicName, String
> > topicDescription, int topicAccessLevel);
>
> >         public void deteleTopic (int topicID);
>
> >         public void addThread (String threadTitle, String threadDesc, int
> > threadAccessLevel, int threadCreatorID, int topicID);
>
> >         public void modifyThread(int threadID, String threadTilte, String
> > threadDescription, int threadAcessLevel);
>
> >         public void deleteThread(int threadID);
>
> >         public void addThreadReply(int threadID, int replierID, Date
> > replyTimestamp, String replyContent);
>
> >         public void modifyThreadReply(int threadReplyID, Date
> > modifyTimestamp, String replyContent);
>
> >         public void deleteThreadReply(int threadReplyID);
>
> > }
--~--~---------~--~----~------------~-------~--~----~
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