flex中remoteObject和httpservice的取舍
remoteObject和java交互的时候需要在remoting-config.xml文件中配置,用httpservice和java交互的时候需要在struts文件中配置action或者在web.xml中配置servlet。httpservice在与action或者servlet交互的时候是可以获取request对象的,所以httpservice可以代替所有remoteObject实现的方法,而remoteObject却不能代替httpservice实现的方法。 下面来一个httpservice和java交互的例子。 struts配置 java代码 该action实现了ServletRequestAware,ServletResponseAware接口 public void getAllDoBaseSheet() throws Exception{ String account = this.getSessionValue(SessionUtil.accountName); String userName = this.getSessionValue(SessionUtil.userName); request.setCharacterEncoding("UTF-8"); response.setContentType("text/html;charset=utf-8;"); log.info("查询代办工单方法执行了"); try{ baseSheetDtolist = baseSheetService.getAllDoBaseSheet(account,userName); }catch(Exception e){ e.printStackTrace(); } StringBuffer josn = new StringBuffer(); josn.append("["); if(baseSheetDtolist!=null && baseSheetDtolist.size()>0){ for(int i=0;i
如果仅仅是因为request的话 remote-object也能获取,所以你这个文章没什么参考价值