Desigining a mobile app for an existing Spring MVC application (Spring Mobile or Phonegap)

别说谁变了你拦得住时间么 提交于 2020-01-14 14:32:12

问题


I created a web application on Openshift using Spring MVC and MySQL.

Now I want to go mobile for this application. I want to publish the same application as a mobile app (Android mainly). Primarily, this mobile version should play with HttpPost/Webservice security authorisation too.

I know Pivotal has a Spring Mobile project which helps create a mobile site for the same application (with more sophistication like spring form tags and all).

On the other hand, Phonegap can create a cross-platform mobile app with the help of HTML5 and CSS.

My questions are:

  • Is it worth it to put my effort on Phonegap or Spring Mobile?
  • If I choose Spring Mobile, how do I publish a mobile app in the Android Play store?

Some pros and cons or any links for reference would be helpful.


回答1:


Intro

First, let me give you a warning. While this is a constructive question (better than average questions asked here), people usually like questions from users who spent some time searching for an answer themselves. I will explain this part later.

Differences

Phonegap (Cordova) and Spring Mobile are two completely different frameworks, they serve completely different purposes. You could have found that Googling.

Phonegap (Cordova) is a wrapper framework used for hybrid mobile app creating. Your HTML/CSS/JavaScript code is wrapped into native shell and you can use JavaScript <-> Native bridge code to access native phone functionality. Though you can use it as it is with vanilla JavaScript, it is often used with other mobile frameworks like jQuery Mobile, Sencha Touch, or Kendo UI.

Spring Mobile is an extension to Spring MVC that aims to simplify the development of mobile web applications. Spring Mobile is a framework that provides capabilities to detect the type of device making a request to your Spring web site and serve alternative views based on that device.

Effort

Everything depends what are you going to do. Hybrid mobile applications are usually done with separate client and server side code. Communication is done using AJAX. Because of this I would skip Spring Mobile and use only Spring as a RESTful web service framework. I personally prefer Play framework, but that's just me.

Of course, you would still need to choose a client-side JavaScript framework, or you can create everything from scratch. I would advise you to use prebuilt frameworks like mentioned jQuery Mobile.

If you really really want to use Spring Mobile

If you really want to use Spring Mobile, it can still be done. Phonegap can be used to wrap remote web sites into mobile applications. This approach has several downsides. The application is useless if your site is down and you will not be able to create iOS application because these kinds of applications are rejected on first sight.

Best course of action

  • Separate client and server side code
  • Choose a client side mobile JavaScript framework.
  • Use Spring as RESTful web service, or any other RESTful framework such as Play.
  • Wrap your client side code into Phonegap (Cordova)
  • Publish as Android, iPhone application

Links

  1. How to create jQuery Mobile application with Phonegap | Mac version
  2. Sencha Touch vs jQuery Mobile
  3. Secrets of a good jQuery Mobile page architecture
  4. If you already have experience with jQuery, learn the differences between jQuery and jQuery Mobile



回答2:


http://projects.spring.io/spring-android/

Spring for Android is a framework that is designed to provide components of the Spring family of projects for use in Android apps. Like all Spring projects, the real power of Spring for Android is found in how easily it can be extended.



来源:https://stackoverflow.com/questions/23713835/desigining-a-mobile-app-for-an-existing-spring-mvc-application-spring-mobile-or

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!