Reputation: 1
i developed one system in gwt java. web applicantion
Now i want to implement servlet in that, i enabled the dynamic web module for my project. Now please tell how to implement servlet and how to call? and how execute it.
Upvotes: 0
Views: 353
Reputation: 46841
Your question is too broad. I can't answer it here but I can provide your some links form where get the understanding of GWT RPC calls
.
Please have a look at below links to find some tutorial and sample code:
Here is architecture diagram of the GWT RPC Mechanism.
Upvotes: 0
Reputation: 8158
You can use Servlet in you project the same way as you would do in any normal web application.
In a GWT application, the package structure should contain 3 main packages: client, server and shared.
client package should contain files having front end code, i.e. GWT code only.
server package should contain files having server side code only.
shared package should contain shared files like images, css etc.
So to explain in brief, you just need to do the following:
In client package, create an Entry-point class (which I think you are already have created because you already have a GWT app).
Now as GWT uses RPC to make server calls, create a service interface which must extend RemoteService.
As GWT uses Asynchronous communication, create another interface which will be the asynch version of the formerly created interface in the same client package.
Both the interfaces should contain mathod signatures defined in the servlet.
In server package, create a Servlet class.
Define web.xml in war/WEB-INF package.
To make a server call, say for example, on click of a Button, inside the click handler of the button, make an instance of the asynch interface using GWT and call the method defined in the servlet and declared in the interface.
To get the call back from the server to the client, you can also use AsyncCallback interface.
To have an working example and details explanation refer to the following links:
http://www.gwtproject.org/doc/latest/DevGuideServerCommunication.html http://www.vogella.com/tutorials/GWT/article.html
Upvotes: 1