Google Web Toolkit (GWT) 创建、读取、更新和删除 (CRUD) 应用程序的示例
你好
有谁知道任何基于 Google Web Take (GWT) 的创建、读取、更新和删除应用程序的示例。
即,使用 GWT 来操作和显示数据库内容的应用程序。
谢谢
Hello
Does anybody know of any examples of a Google Web Took (GWT) - based Create Read Update and Delete application.
That is, an application which uses the GWT to manipulate and display the contents of a database.
Thanks
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
网上这样的例子并不多。
但这就是我通常这样做的方式:
假设您想从数据库中获取某个表的所有内容:
在 GreentingService.java 中执行以下操作:
公共接口 GreentingServiceextends RemoteService
{
ArrayList getEverything();
}
公共接口GreentingService
{
void getEverything(AsyncCallback 回调);
}
这是您调用此方法并使用数据的方式:
公共 Someclass 实现 EntryPoint
{
公共无效 onModuleload()
{
SQLRunnerAsync sql = (SQLRunnerAsync) GWT.create(SQLRunner.class);
异步回调>回调 = new AsyncCallback>(){
<预><代码> @Override
公共无效onFailure(Throwable捕获){
//什么都不做
}
@覆盖结果){
公共无效onSuccess(ArrayList
for(int i = 0; i < result.size(); i++)
{
}
}};
sql.getEverything(回调);
............
}//onModulelOad
}//class
以下是一个很棒的教程:
http: //altair.cs.oswego.edu/~tenberge/tenbergen.org/misc/DB-Access-in-GWT-The-Missing-Tutorial.pdf
There are not too many such examples online.
But this is how I usually do it:
Lets assume that you want to get all the contents of a certain table from the database:
in GreentingService.java do following:
public interface GreentingServiceextends RemoteService
{
ArrayList getEverything();
}
in GreentingServiceSync.java do following:
public interface GreentingService
{
void getEverything(AsyncCallback callback);
}
finally in GreentingServiceImpl do following:
this is how you will call this method and use the data:
public Someclass implements EntryPoint
{
public void onModuleload()
{
SQLRunnerAsync sql = (SQLRunnerAsync) GWT.create(SQLRunner.class);
AsyncCallback> callback = new AsyncCallback>(){
...............
}//onModulelOad
}//class
Following is a great tutorial:
http://altair.cs.oswego.edu/~tenberge/tenbergen.org/misc/DB-Access-in-GWT-The-Missing-Tutorial.pdf
GWT 是一种客户端技术,因此基本上只为您提供 UI。任何 CRUD 过程都将发生在服务器端,这可以是任何 J2EE 代码。
无论如何,您可以查看 StockWatcher 示例,它为您提供了解决您的问题的好方法(您需要实现服务器端存储)
另请参阅 RequestFactory 文档
它对您有帮助吗?
GWT is a client side technology, so basically gives you only the UI. Any CRUD process would happen in the server side, which could be any J2EE code.
Anyway you can take a look to the StockWatcher Example which gives you a good approach to your question (you need to implement the server side storage)
Also take a look to the RequestFactory documentation
Does it help you?
这是一个骨架 CRUD 应用程序,这对于寻找同一问题答案的人来说会很有帮助
http:// code.google.com/p/gwtcrudapp/
This is a skeleton CRUD application, I this would be helpful for someone looking answer for the same question
http://code.google.com/p/gwtcrudapp/
这是一个基于 Web 的 CRUD 应用程序,是我在过去几年中为我的雇主编写的,现在已获得开源许可:
https://github.com/fhcampuswien/atom
前端使用GWT,后端使用Hibernate来持久化数据。数据结构只需要在一个中心位置(DomainObject 类)定义,因为 GUI 和后端都是以不依赖于数据结构的通用方式编写的。
如果有人有时间看一下,我很乐意听到评论或回答有关它的问题。
This is a web-based CRUD-Application that I've wrote for my employer over the last few years and now got permission to open-source it:
https://github.com/fhcampuswien/atom
It uses GWT for the front-end and Hibernate to persist the data in the backend. The data-structure only needs to be defined in one central place (the DomainObject classes), since both GUI and backend are written in a generic way that is not dependent on the data-structure.
I'd love to hear comments or answer questions about it if anybody finds the time to take a look.