FLEX 与 JSP 视图的结合开发

阅读更多
FLEX 与 JSP 视图的结合开发

虽然用了flex作了视图层,但实际开发中难免有用到jsp视图的时候,这个时候就需要考虑将二者结合开发了。

方式一 :采用flex 到jsp的跳转方式
需要jsp视图的时候,可以采用在flex中加入页面跳转,跳转到jsp页面上去,从而达到两种视图的结合。
var faultid:int =  event.target.data.id;
urlRequest.url = encodeURI(_webRootURL + "/webpages/xx.jsp?faultid=" + faultid);
navigateToURL(urlRequest,"_blank");  


路径_webRootURL可用通过flex与js交互获得到。

//获取web根路径
_webRootURL = ExternalInterface.call("getWebRooURL");

function getWebRooURL(){
    var strFullPath=window.document.location.href;
    var strPath=window.document.location.pathname;
    var pos=strFullPath.indexOf(strPath);
    var prePath=strFullPath.substring(0,pos);
    var postPath=strPath.substring(0,strPath.substr(1).indexOf('/')+1);
    return(prePath+postPath);
}

方式二:采用flex第三方控件Google Iframe方式
采用Google Iframe(https://github.com/flex-users/flex-iframe),使jsp页面嵌入flex中,优点是视图形式上统一,且更协调。

	


[img]
FLEX 与 JSP 视图的结合开发_第1张图片
[/img]

其中有几点要注意的是:
* iframe 外面的区域 iframe会消失
打开html模板

                    
                    

你可能感兴趣的:(flex,jsp,html,web)