简体   繁体   中英

Is it possible to create an offline application with Wicket?

Is there a way to make an offline application using Wicket? If so, would it be necessary to use another tool/framework (Gears, Spring, etc)?

Wicket is a server-side technology, just like servlets, jsp, etc; meaning that it generally requires an application-server to host the application. There's no offline equivalent that I'm aware of.

Spring can be also be run on an application server or be used to construct desktop applications. Perhaps you'll consider a desktop application to be offline?

Maybe. Of course, you can use Wicket to generate HTML and JavaScript that executes on the client only without ever talking to a server.

So you can use any technology that you like but you must write the HTML in such a way that it never sends requests. That means for example: All links and forms must be handled by JavaScript functions.

You can bundle a lightweight server with it. My favorite application that does this is Google Refine, it is a pure web app that bundles a lightweight embedded web server (Jetty): http://code.google.com/p/google-refine/

If I understand the question you are talking about HTML5 offline mode. This is what I think is the best approach: With Wicket.Ajax.registerPreCallHandler() you can add an interceptor (a function) that will check window.offline and either let the ajax call go to the server or suppress it and execute some custom JavaScript that will save the related data in browser's DB (see localStorage, IndexedDB, web sql database). Ie it is your job to decide what to happen when linkX is clicked and there is no internet connection. In this case you'll need also to subscribe for "ononline" event and upload the collected data when the connection is back.

Sounds like a fun project. Good luck!

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM