首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 移动开发 > 移动应用 >

Spring开始关切移动应用开发,发布Spring Mobile,Spring Android

2012-09-01 
Spring开始关注移动应用开发,发布Spring Mobile,Spring Android近日,Roy Clarkson发布了Spring Mobile和Sp

Spring开始关注移动应用开发,发布Spring Mobile,Spring Android
近日,Roy Clarkson发布了Spring Mobile和Spring Android。


Spring Mobile


Spring Mobile 是 Spring MVC 的扩展,用来简化手机上的Web应用开发。



interceptor 定义的示例:

<interceptors>       <!-- On pre-handle, detect the device that originated the web request -->       <beans:bean />   </interceptors>  <interceptors>    <!-- On pre-handle, detect the device that originated the web request -->    <beans:bean /></interceptors>


如果该设备不是移动设备,JSP模板也能有内容的呈现:


Please try again<c:if test="${!currentDevice.mobile}"> or <a href="<c:url value="/signup" />">sign up</a></c:if>  Please try again<c:if test="${!currentDevice.mobile}"> or <a href="<c:url value="/signup" />">sign up</a></c:if> 


如果该设备是一个移动设备,基于Tiles的页面布局将会改变:

Java代码
<definition name="page" templateExpression="/WEB-INF/layouts/${currentDevice.mobile ? 'mobile/' : 'standard/'}page.jsp" />  <definition name="page" templateExpression="/WEB-INF/layouts/${currentDevice.mobile ? 'mobile/' : 'standard/'}page.jsp" />  


Spring Android


Spring Android 是 Spring 框架的扩展,用于简化 Android 本地应用程序的开发。



针对Andriod的客户端,出现了不同的挑战。需要通过REST,与HTTPS服务器上的数据进行交流,因为数据是用户特定的,我们需要知道用户登录是不是使用了基本认证,而且我们也需要将用户名跟密码存储在设备上,所以我们选择了OAuth(查看更多关于OAuth的介绍)http://www.williamlong.info/archives/2185.html。


点击查看更多详情:http://blog.springsource.com/2010/11/19/spring-into-mobile-application-development/

热点排行