前往小程序,Get更优阅读体验!
立即前往
首页
学习
活动
专区
工具
TVP
发布
社区首页 >专栏 >Flex开发中使用Ant编译.mxml成.swf后,在.swf里使用Session的解决方法 博客分类: RIA FlexAntServl

Flex开发中使用Ant编译.mxml成.swf后,在.swf里使用Session的解决方法 博客分类: RIA FlexAntServl

作者头像
阿敏总司令
发布2019-02-28 11:40:39
6100
发布2019-02-28 11:40:39
举报
文章被收录于专栏:简单就是美!

阅读更多

Flex开发中使用Ant编译.mxml成.swf后,在.swf里使用Session的解决方法

http://iamin.blogdriver.com/iamin/1176113.html

Flex Remote Object中直接使用HttpSession的方法在Flex Samples里有Session的操作使用例子: http://localhost:8080/samples/explorer/misc/ServerSessionDemo.mxml 但是,使用mxmlc编译.mxml成.swf后,在.swf里是没有办法使用Session的

解决办法:可以通过RemoteObject的通讯方式来进行Session的处理

http://livedocs.macromedia.com/flex/15/flex_docs_en/wwhelp/wwhimpl/common/html/wwhelp.htm?context=Flex_Documentation&file=00002247.htm

Working with session data A Java object that you call using the <remoteobject></remoteobject>tag has access to request, response, and servlet data. From within a Java object, you can call the following methods:

Method Description flashgateway.Gateway.getHttpRequest()

Returns the HttpServletRequest object for the current request. Macromedia recommends that you access session data and other request data through the getHttpRequest() method.

flashgateway.Gateway.getHttpResponse()

Returns the HttpServletResponse object for the current request.

flashgateway.Gateway.getServletConfig()

Returns the ServletConfig object for the calling servlet.

To compile calls with these methods in their classes, you must have the WEB-INF/lib/flashgateway.jar file in your classpath.

The following example shows code in a Java class for accessing a session attribute:

String fooAttrib = (String)flashgateway.Gateway.getHttpRequest().getSession(). getAttribute("attr1");

这样,.mxml文件经过编译成.swf后,照样可以进行使用Session了。

本文参与 腾讯云自媒体同步曝光计划,分享自作者个人站点/博客。
原始发表:2006-04-30 ,如有侵权请联系 cloudcommunity@tencent.com 删除

本文分享自 作者个人站点/博客 前往查看

如有侵权,请联系 cloudcommunity@tencent.com 删除。

本文参与 腾讯云自媒体同步曝光计划  ,欢迎热爱写作的你一起参与!

评论
登录后参与评论
0 条评论
热度
最新
推荐阅读
领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档