flex获得session
--------web.xml文件
<listener>
<listener-class>flex.messaging.HttpFlexSession</listener-class>
</listener>
--------Java代码
public class GetSeesion {
/**
* 设置session
* */
public void setSession(String name,String value){
FlexContext.getFlexSession().setAttribute(name, value);
}
//获得session
public String getSession(String name){
String userid=(String) FlexContext.getFlexSession().getAttribute(name);
return userid;
}
}
----------在remoting-config.xml中加入
<!-- 用户信息保存到session中 -->
<destination id="sessionBiz">
<properties>
<source>com.ssfx.util.GetSeesion</source>
<scope>application</scope>
</properties>
</destination>
-------使用session
<mx:RemoteObject id="sBiz" destination="sessionBiz" showBusyCursor="true">
<mx:method name="setSession"/>
<mx:method name="getSession" result="sessionHandle(event)"/>
</mx:RemoteObject>
<script>
<![CDATA[
sBiz.setSession("userId",txtUserId.text);
sBiz.getSession("userId");
/* 获得后台session处理函数 */
private function sessionHandle(event:ResultEvent):void{
var userCode=String(event.result);
this.addPlanMess(userCode);
}
]]>
</script>
相关文档:
工程下的history文件夹下存放三个文件:index.template.html,rightClick.js,swfobject.js
src文件夹下存放CustomContextMenu.mxml文件。
1.CustomContextMenu.mxml:
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute"
applicati ......
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute">
<mx:Style>
ScrollBar
{
/*划动块图片皮肤*/
thumbDownSkin: Embed(source="scrollBar/thumb. ......
<?xml version="1.0" encoding="utf-8"?>
<Application xmlns="http://www.adobe.com/2006/mxml"
backgroundGradientColors="[0x000000,0x000000]"
themeColor="#222222"
horizontalAlign="left"
paddingLeft="10" paddingRight="10"
creationComplete="genData();"
viewSourceURL="srcview/index.ht ......
为了在应用程序中使用数据,Adobe Flex 包括了与HTTP servers,web services 或remoteobject services
(Java objects)进行交互的组件,这些组件被称之为远程过程调用(RPC)服务组件。
与 Adobe ColdFusion,PHP 或类似的服务器技术不同,Flex 应用程序并不直接连接数据
库。举 ......
<mx:HSlider id="priceSlider" creationComplete="{HsilderChangeThumb(event)}"/>
<mx:Script>
<![CDATA[
private function HsilderChangeThumb(e:Event):void
{
var slider:HSlider = e.target as HSlider;
&nbs ......