REMOTEOBJECT:
package com.test;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSession;
import flex.messaging.*;
public class GETSESSION {
public GETSESSION() {
// TODO Auto-generated constructor stub
}
public void setSession(String atr,Object val){
HttpServletRequest request = FlexContext.getHttpRequest();
HttpSession session = request.getSession();
session.setAttribute(atr,val);
}
public Object getSession(String atr){
HttpServletRequest request = FlexContext.getHttpRequest();
HttpSession session = request.getSession();
return session.getAttribute(atr);
}
}
PS1:我的remoting-config.xml:
com.test.GETSESSION
PS2:返回的OBJECT如果想要與AS3的OBJECT轉化的話這個類要實現序列化(Serializable),還必須有get set方法, maybe flex access to the object with this javacode
mxml:
}
]]>
source:
http://bjutren.spaces.live.com/blog/cns!B6940F2EF5F948FC!162.entry?sa=588346105
reference:
Flex Remote Object中直接使用HttpSession的方法
http://blog.csdn.net/kerry365/archive/2005/09/23/488217.aspx
沒有留言:
張貼留言