解决flex的HttpService缓存的问题

Flex的Httpservice在重复发送请求的时候会默认获得首次的结果,也就是会读取缓存,为了使httpservice的数据更新,需要在其url中加上可变的内容,在url后面加上时间就可以解决,如下:

var time = (new Date).getTime().toString();

<mx:HTTPService id=httpSvr"
url="httpServlet?time={time}"
resultFormat="e4x"
result="httpSvr_resultHandler(event)"/>

其中{time}必须在httpservice外部赋值,否则它也将读取缓存。

猜你喜欢

转载自blog.csdn.net/raphero/article/details/8514191
今日推荐