移动Web应用程序的服务器端体系结构 [英] Server-side architecture for mobile web applications

查看:127
本文介绍了移动Web应用程序的服务器端体系结构的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在我曾经做过的大多数桌面Web应用程序中,您需要一个服务器端Web框架。服务器端Web框架(Struts,Spring MVC等)具有某种用于处理请求的控制器,然后是用于生成动态内容的模板引擎(Velocity,JSP等)。

In most desktop web applications I've ever worked on you need a server-side web framework. The server-side web framework (Struts, Spring MVC, etc) has some kind of controller for processing requests and then a templating engine (Velocity, JSP, etc) for generating dynamic content.

现在我开始研究移动Web应用程序,我看到的所有讨论都围绕着选择一个UI框架(jQuery Mobile,jQTouch,Sencha Touch等),但我没有看到任何有关正在发生的事情的讨论。服务器端实际处理HTTP请求或生成HTML,CSS和JavaScript。

Now I am starting to work on mobile web applications and all the discussions I see revolve around selecting a UI framework (jQuery Mobile, jQTouch, Sencha Touch, etc) but I don't see any discussion of what is happening on the server-side to actually process HTTP requests or to generate the HTML, CSS, and JavaScript.

这是否意味着大多数移动Web应用程序不使用服务器端Web框架...意味着服务器提供静态内容,大多数交互行为都是用JavaScript编码的,唯一的服务器端代码是JavaScript客户端加载的REST服务?

Does this mean that most mobile web applications do not use a server-side web framework... meaning the server serves static content, the majority of the interactive behavior is coded in JavaScript, and the only server-side code is REST services that the JavaScript client loads?

如果我想使用服务器端Web框架那会是个坏主意吗?我会遇到什么问题?有没有人对Web框架提出建议,这将是一个高效的平台,而不是像jQuery mobile这样的移动UI框架阻碍?

If I wanted to use a server-side web framework would that be a bad idea? What problems would I face? Does anyone have a recommendation on web framework that would be a productive platform and not "get in the way" of mobile UI frameworks like jQuery mobile?

注意:开发人员我工作主要来自企业Java背景,但是,我不会将其限制为仅基于Java的web framoworks。还有其他框架可以考虑使用Java(Grails,Lift等)。

NOTE: The developers I work with mostly come from enterprise Java backgrounds, however, I wouldn't limit it to only Java-based web framoworks. There are other frameworks out there that have roots in Java that could be considered (Grails, Lift, etc).

推荐答案

一个好的问题肯定,我会这样回答。目前的趋势是在前端建立大量的互动性。有几个原因。有些人这样做是因为这是新事物,其他人这样做是因为他们试图复制桌面体验。最后,任何给定的Web项目只有一个目标,那就是创建最佳和最可持续的用户体验。

A good question for sure and I will answer it this way. The current trend is to build a lot of interactivity into the front end. There are several reasons for this. Some do it because it's the new thing to do, others do it because they're trying to replicate the desktop experience. In the end, there is only one goal for any given web project and that is to create Best and Most Sustainable User Experience.

话虽如此,会有服务器端技术来避免,而这将是为您生成前端的任何一种技术但不是使用jQuery。今天超过45%的网站使用jQuery,如果你选择其他东西,你将立即与流行的移动框架发生冲突。 (GWT,IceFaces,我在看着你)。

That being said, there would be server side technologies to avoid and that would be any of that generate the front end for you but are not using jQuery. Over 45% of all websites today use jQuery and if you select something else, you will be instantly at odds with the prevailing mobile frameworks. (GWT, IceFaces, I'm looking at you).

可能最安全,最灵活的方法是使用基于Spring的实现或 Prime Faces 。 Spring Mobile值得关注。 Prime Faces实际上实现了jQuery Mobile,并且可以使用Theme Roller进行主题化。

Probably the safest and most flexible way to go would either be using a Spring based implementation or Prime Faces. Spring Mobile is worth looking at. Prime Faces actually implements jQuery Mobile and is theme-able using Theme Roller.

一般来说,你使用的后端框架(如果有的话)并不重要只要你推动好标记。浏览器并不关心,用户唯一关心的是良好的体验。所以,只要它不妨碍你选择任何会让你的开发者为后端感到满意的东西。

In general, it really doesn't matter what backend framework (if any) that you use so long as you're pushing good markup. The browser doesn't care and the only thing that user's care about is a good experience. So, pick whatever will make your devs happy for the backend so long as it doesn't get in the way.

至于前端框架,是的,它们的受欢迎程度正在提高,因为它们确实倾向于标准化移动设备中的一些最佳实践。 jQuery Mobile vs Sencha vs jQTouch有很多比较。我将告诉你哪个最适合你的项目,但肯定会使用jQuery Mobile或Sencha,因为围绕这些的社区支持是巨大的,你不太可能看起来像许多破旧的本土移动网站那样当他们没有经验将其拉下来时,他们试图从头开始。这太可悲了。我的个人推荐是jQuery Mobile,因为它涵盖了如此广泛的设备,并且(如果您坚持使用标准的逐页模型)即使是最疯狂的功能手机也会优雅地降级,并且仍然可以正常运行,但在智能手机上看起来很棒。

As for front end frameworks, yes, their popularity is increasing because they do tend to standardize some of the best practices in mobile. There are many many comparisons of jQuery Mobile vs Sencha vs jQTouch. I'll leave you to figure which is best for your project but would certainly use either jQuery Mobile or Sencha because the community of support around these is massive and you're less likely to look like the many shabby, home-grown mobile sites that tried to do it from scratch when they didn't have the experience to pull it off. It's just sad. My personal recommendation is jQuery Mobile because it's covers such a wide range of devices and (provided you stick to the standard page-by-page model) will degrade gracefully for even the crappiest of feature phones and still be functional but look amazing on smartphones.

关于使用RESTful设计,JavaScript加载所有内容和管理状态的问题。有许多人正在这样做,这肯定是一个快乐的经历,但你会立即限制谁可以使用它的移动浏览器支持良好的JavaScript的人。您将只关注支持iOS,Android 2.2 +,BlackBerry 6+和Windows Phone 7+。所有其他人可能在查看您的网站时遇到很大困难。在转向这样的实现之前,请仔细考虑您的受众。如果您的网站在没有JavaScript的情况下无法工作,而您的主要客户都在企业界...当最新的黑帽会议暴露公司电话的弱点和保守风险缓解(偏执)时会发生什么,他们会推出一项安全政策每个人都禁用JavaScript的手机。这种事情一直都在发生。所以,考虑一下你的观众。

To your question of just using a RESTful design with JavaScript loading everything and managing state. There are many that are doing that and it's certainly a snappy experience but you'll be instantly limiting who can use it to people who's mobile browsers support good JavaScript. You'll be looking at only supporting iOS, Android 2.2+, BlackBerry 6+, and Windows Phone 7+. All others will likely have significant difficulty viewing your site. Carefully consider your audience before moving to an implementation like that. If your site wont work without JavaScript and your primary clients are in the corporate world... what happens when the latest Black Hat conference exposes a weakness in the company phones and out of conservative risk mitigation (paranoia), they push a security policy to everyone's phones that disables JavaScript. This kind of thing happens all the time. So, consider your audience.

这篇关于移动Web应用程序的服务器端体系结构的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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