将桌面网络应用程序转换为移动应用程序? [英] converting desktop web app to mobile app?

查看:133
本文介绍了将桌面网络应用程序转换为移动应用程序?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在开发基于桌面的响应式Web应用程序,其中UI/前端将使用HTML/JS,后端将是servlet或struts/spring控制器.

I am working on desktop based responsive web application where UI/front end will be in HTML/JS and back end point will be either servlets or struts/spring controllers.

我的问题是说3年后我想拥有android移动应用程序,可以 我继续使用servlet作为后端代码,并提供来自android移动应用的响应,

My question is say after 3 years i want to have android mobile app , can I continue to use my servlet as back end code and serves the response coming from android mobile app,

我的理解:-我将使用android SDK开发本机UI部分(无论何时需要),然后可以与现有servlet进行通信. 然后,移动设备上的android应用可以呈现从我的servlet返回的html,或者servlet可以返回android特定的视图.因此,仅当我需要针对移动应用程序的自定义视图(html或android特定视图)时才需要进行更改.是吗?

Mine understanding :- I will develop the native UI part(wherever it is required) using android SDK which then can communicate with existing servlets . Then android app on mobile can render the html returned from my servlets or servlets can return the android specific views. so changes are required only whenever i need custom views(htmls or android specific views) for my mobile application. Is that right ?

推荐答案

3年后...我可以继续使用我的servlet作为后端代码并提供来自android移动应用程序的响应

after 3 years... can I continue to use my servlet as back end code and serves the response coming from android mobile app

我们无法准确预测未来.

We have no way of predicting the future with accuracy.

然后,移动设备上的android应用可以呈现从我的servlet返回的html

Then android app on mobile can render the html returned from my servlets

要在Android中呈现HTML,请使用WebView(或也许第三方库,尽管这种情况并不常见). WebView处理很多东西,但不能处理桌面浏览器所做的所有事情.从现在起三年后,所有功能的运行情况尚不清楚,而无论您的网站做什么,它在今天的运行情况都未知.

To render HTML in Android, you use WebView (or maybe a third-party library, though that is uncommon). WebView handles lots of stuff but not everything that a desktop browser does. How well that all works three years from now is unknown, and how well it works today with whatever your Web site does is unknown.

或servlet可以返回android特定的视图

or servlets can return the android specific views

否.

因此仅当我需要针对移动应用程序的自定义视图(html或android特定视图)时才需要更改

so changes are required only whenever i need custom views(htmls or android specific views) for my mobile application

您能使它正常工作吗?可能,但是细节将在很大程度上取决于现有网站的工作以及它所依赖的客户端技术的种类.例如,Android不支持Flash.在基于Java的UI和基于WebView的UI之间进行互操作还存在一些技术和安全性问题,尽管这种情况在您的情况下要好一些,因为您只使用一台服务器(我认为).

Can you get that to work? Possibly, but the details will depend a lot on what your existing Web site does and what sorts of client-side technologies it depends upon. For example, Android does not support Flash. There are also technical and security issues with interoperating between Java based UIs and WebView-based UIs, though this is a bit better in your case, as you are only hitting one server (I think).

话虽如此,我永远不会以这种方式编写Android应用程序,并且我绝不建议其他人以这种方式编写Android应用程序.我将修改Web服务器以具有适当的Web服务API,并编写一个使用该Web服务API的本机Android应用程序,而不使用返回HTML的servlet.我会使用WebView的主要位置是当我拥有仅存在于HTML中的材料时,通常是因为我没有首先创建HTML(例如,用户生成的内容).

All that being said, I would never write an Android app this way, and I would never recommend anyone else write an Android app this way. I would revise the Web server to have a proper Web service API, and I would write a native Android app that uses that Web service API, not using servlets returning HTML. The primary place where I would use WebView is when I had material that only exists in HTML, typically because I did not create the HTML in the first place (e.g., user-generated content).

首要的问题是我是否可以继续使用现有的servlet.我认为它不是基于观点的.应该为是或否

Primarily mine question is can I continue to use existing servlets. I don't think its based on opinion. It should be either yes or no

当然不是是或否".我们无法预测未来,我们对该网站几乎一无所知.您的问题收集了两个过于广泛"的接近票数,这是一个合理的评估.

Of course it is not "yes or no". We have no way of predicting the future, and we know almost nothing about the Web site. Your question collected two "too broad" close votes, and that is a reasonable assessment.

这篇关于将桌面网络应用程序转换为移动应用程序?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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