问题
Our application is supposed to serve multiple devices, from simple to smart-phones, IPhones, touch-screens to normal browsers.
Application is layered, so we can reuse the business and persistence layer. However, we would like to program single presentation layer as well. I know for example that ASP .NET generates different html output based on the browser type. http://msdn.microsoft.com/en-us/library/ms178620.aspx
There are even some sites that promise to transform your site to mobile: http://instantmobilizer.com
Is there a java framework capable of producing the presentation that adapts to client browser and device, so that we do not need to program different presentation layer for each device type? What is the standard way to manage multiple devices support requirement in web applications?
回答1:
While it's true that you can conceivably generate different markup styles from a single view implementation (e.g. using different XSL transforms selected based on device type), you're still going to end up saddled with the "lowest common denominator" interface.
To take a slightly artificial (and dated) example, say you wanted to generate WML, low-end HTML and high-end XHTML from a single view implementation. Since WML is the most basic of the three, your view would not be able to take advantage of the capabilities of the more advanced representations, beyond the purely cosmetic. In this example, WML can only render very basic forms, whereas high-end XHTML devices can do fancy CSS and javascript stuff.
You want to be able to take advantage of the capabilities of the various classes of device, otherwise it'll just end up looking crappy and primitive on all of them.
When you have devices as diverse as mobile phones, iphones, and desktop browsers, having a single view that satisfies all of them isn't really practical.
In practice, the best option is to detect the device type when the user enters the system, and then set them off on a view sequence tailored to that specific device.
回答2:
The standard way to handle multiple devices connecting to a single web application is to write seperate presentation layers custom tailored to each device.
Short of doing that, you might want to check out the media
attribute for CSS references. It will at least allow you to provide a different stylesheet for mobile devices (even though it won't seperate a Motorola Razr from a Blackberry Bold):
CollyLogic: 7 steps to better handheld browsing
回答3:
Sure the standard way to handle multiple devices connecting to a single web application is doing different presentation for each device. One framework that enables all this is ZK you can see live demo at http://www.zkoss.org/zkdemo/userguide/#f2
来源:https://stackoverflow.com/questions/1881547/presentation-technology-for-multiple-devices