开发者

Is it possible to save state of Web application

I build a Web application using GWT (and/or SmartGWT) that uses a number of forms to collect data. Is 开发者_开发知识库it possible to save the progress so that the user can leave the application and when comes back continues with the data (s)he has already entered?

If yes, do I have to use a database?


Of course.

One of the way is use the GWT 's RPC framework to make calls to Java servlets . You do not need a database to store the form data as you can store the form data inside the HttpSession object provided by the Java servlets . You can imagine HttpSession has a built-in data store that allows you to store any number of key/value pairs and each client has their own HttpSession.

You can refer to the followings links/ tutorials to get the basic ideas .


References

  • Using Servlet Sessions in GWT – Tutorial
  • Google Web Toolkit (GWT) & Servlets - Web application tutorial
  • Google official document - Communicate with a Server


Another way is to store the data in the browser. This way you won't need a server-side database.

You can either use browser cookies (note that cookies expire...):
http://google-web-toolkit.googlecode.com/svn/javadoc/2.3/com/google/gwt/user/client/Cookies.html

Or the all new GWT HTML5 storage API:
http://code.google.com/webtoolkit/doc/latest/DevGuideHtml5Storage.html
http://google-web-toolkit.googlecode.com/svn/javadoc/2.3/com/google/gwt/storage/client/Storage.html

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜