为现有的Spring MVC应用程序(Spring Mobile或Phonegap)设计一个移动应用程序 [英] Desigining a mobile app for an existing Spring MVC application (Spring Mobile or Phonegap)

查看:118
本文介绍了为现有的Spring MVC应用程序(Spring Mobile或Phonegap)设计一个移动应用程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用Spring MVC和MySQL在Openshift上创建了一个Web应用程序.

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

现在,我想为该应用程序而移动.我想发布与移动应用程序相同的应用程序(主要是Android).首先,此移动版本也应具有HttpPost/Webservice安全授权.

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.

我知道Pivotal有一个Spring Mobile项目,该项目可以帮助为同一应用程序创建一个移动站点(具有更多复杂性,例如spring表单标签等).

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).

另一方面,Phonegap可以借助HTML5和CSS创建跨平台的移动应用.

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

我的问题是:

  • 花点时间在Phonegap或Spring Mobile上值得吗?
  • 如果我选择Spring Mobile,如何在Android Play商店中发布移动应用?

一些利弊或任何参考链接都将有所帮助.

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

推荐答案

简介

首先,让我警告您.尽管这是一个建设性的问题(比这里的平均问题要好),但人们通常喜欢用户花了一些时间自己寻找答案的问题.我将在后面解释这部分.

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.

Phonegap(Cordova) Spring Mobile 是两个完全不同的框架,它们的用途完全不同.您可能已经发现谷歌搜索.

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

Phonegap(Cordova)是用于混合移动应用程序创建的包装器框架.您的HTML/CSS/JavaScript代码包装在本机外壳中,您可以使用JavaScript<->本机桥接代码来访问本机电话功能.尽管您可以像使用普通JavaScript一样使用它,但是它经常与其他移动框架(如jQuery Mobile,Sencha Touch或Kendo UI)一起使用.

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 是Spring MVC的扩展,旨在简化移动Web应用程序的开发. Spring Mobile是一个框架,该框架提供的功能可以检测对您的Spring网站发出请求的设备的类型,并基于该设备提供备用视图.

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.

一切取决于您要做什么.混合移动应用程序通常使用单独的客户端和服务器端代码来完成.通信是使用AJAX完成的.因此,我将跳过Spring Mobile,仅将Spring用作 RESTful Web服务框架.我个人更喜欢 Play框架,但这就是我.

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.

当然,您仍然需要选择客户端JavaScript框架,或者可以从头开始创建所有内容.我建议您使用像提到的jQuery Mobile这样的预建框架.

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.

如果您真的想使用Spring Mobile,仍然可以完成. Phonegap可用于将远程网站包装到移动应用程序中.这种方法有几个缺点.如果您的网站关闭,该应用程序将无用,并且您将无法创建iOS应用程序,因为这些应用程序一眼就被拒绝了.

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.

  • 单独的客户端和服务器端代码
  • 选择 客户端移动JavaScript框架 > .
  • Spring 用作 RESTful 网络服务,或任何其他 RESTful 框架,例如Play.
  • 将您的客户端代码包装到 Phonegap(Cordova)
  • 发布为Android,iPhone应用程序
  • 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
  1. 如何 使用Phonegap创建jQuery Mobile应用 | Mac版本
  2. Sencha Touch与jQuery Mobile
  3. 好的jQuery Mobile的秘密页面架构
  4. 如果您已经有使用jQuery的经验,请 了解两者之间的区别jQuery和jQuery Mobile

这篇关于为现有的Spring MVC应用程序(Spring Mobile或Phonegap)设计一个移动应用程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆