1. FlexSSH集成
  2.  
  3. -- ::| 分类: flex |举报|字号 订阅
  4. FlexSSH集成
  5. ,下载blazeds_bin_3---.zip 包,将其解压 取下blazeds.war 更改为blazeds.rar ,并解压
  6. 将上一步解压的web-inf/lib/下的包复制到工程的lib
  7. ,将flex文件夹 复制到工程的web-inf
  8. classes下的文件复制到工程的src
  9. 5web.xml中加入
  10.  
  11. <!-- flex -->
  12. <servlet>
  13. <servlet-name>flex</servlet-name>
  14. <servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
  15. <init-param>
  16. <param-name>contextConfigLocation</param-name>
  17. <param-value>/WEB-INF/classes/flex-application-config.xml</param-value>
  18. </init-param>
  19. <load-on-startup></load-on-startup>
  20. </servlet>
  21. <servlet-mapping>
  22. <servlet-name>flex</servlet-name>
  23. <url-pattern>/ssh/*</url-pattern>
  24. </servlet-mapping>
  25. <!-- end flex -->
  26. 6,在src下建一个flex-application-config.xml文件
  27. 加入
  28. <?xml version="1.0" encoding="UTF-8"?>
  29. <beans xmlns="http://www.springframework.org/schema/beans"
  30. xmlns:flex="http://www.springframework.org/schema/flex"
  31. xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  32. xsi:schemaLocation="
  33. http://www.springframework.org/schema/beans
  34. http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
  35. http://www.springframework.org/schema/flex
  36. http://www.springframework.org/schema/flex/spring-flex-1.0.xsd">
  37. <flex:message-broker/>
  38. <!— 下面是表示 spring配置文件中配置的bean-->
  39. <flex:remoting-destination ref="flowServer"/>
  40. </beans>
  41. 以下内容
  42. 6,加入flexspring所依赖的包
  43. FlexSSH集成 - 花落谁家 - zhangcb666的博客
  44.  
  45. 7 编写 java
  46.  
  47. 1> 编写类体DeptNode.class
  48.  
  49. package com.svse.entity.bean;
  50.  
  51. import java.util.ArrayList;
  52. import java.util.List;
  53. /***
  54. * 注: 此类可以不用和Flex映射 ,因为在Flex端,我们不用把Object对象强转为此对象
  55. **/
  56. public class DeptNode {
  57.  
  58. private int id;
  59. private String name;
  60. private DeptNode parent;
  61.  
  62. private List<DeptNode> children = null;
  63.  
  64. public DeptNode(){}
  65. public DeptNode(int id ,String name){
  66. this.id = id;
  67. this.name = name;
  68. }
  69. /*************get and set 省略****************/
  70.  
  71. }
  72. > 编写接口IflowServer.class
  73. package com.svse.server;
  74.  
  75. import java.util.List;
  76. import com.svse.entity.bean.DeptNode;
  77.  
  78. public interface IFlowServer {
  79. //得到部门
  80. List<DeptNode> getDeparts(int deptId);
  81. }
  82.  
  83. > 编写实现类
  84. package com.svse.server.impl;
  85.  
  86. import java.util.List;
  87.  
  88. import com.svse.entity.bean.DeptNode;
  89. import com.svse.server.IFlowServer;
  90.  
  91. public class FlowServer implements IFlowServer {
  92.  
  93. //得到部门
  94. public List<DeptNode> getDeparts(int deptId){
  95. List<DeptNode> list = new ArrayList<DeptNode>();
  96. DeptNode node = new DeptNode();
  97. node.setId();
  98. node.setName("父节点11");
  99. node.setChildren(this.getChild(, "aa"));
  100.  
  101. list.add(node);
  102.  
  103. DeptNode node2= new DeptNode();
  104. node2.setId();
  105. node2.setName("父节点22");
  106. node2.setChildren(this.getChild(, "bb"));
  107.  
  108. list.add(node2);
  109.  
  110. return list;
  111. }
  112.  
  113. private List<DeptNode> getChild(int count,String name){
  114. List<DeptNode> list = new ArrayList<DeptNode>();
  115. for(int i = ; i < count; i++){
  116. DeptNode node3 = new DeptNode();
  117. node3.setId(i);
  118. node3.setName(name+""+i);
  119. list.add(node3);
  120. }
  121. return list;
  122. }
  123.  
  124. }
  125. }
  126.  
  127. spring中注入
  128. <bean id="flowServer" class="com.svse.server.impl.FlowServer"/>
  129. 注:此处的Id,就是在flex-application-config.xml中的
  130. <flex:remoting-destination ref="flowServer"/>配置的ref
  131.  
  132. 编写flex代码
  133.  
  134. <?xml version="1.0" encoding="utf-8"?>
  135. <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" creationComplete="init()">
  136. <mx:Script>
  137. <![CDATA[
  138. import mx.rpc.remoting.mxml.RemoteObject;
  139. import bean.FileAction;
  140. import mx.collections.ArrayCollection;
  141. import mx.rpc.events.FaultEvent;
  142. import mx.rpc.events.ResultEvent;
  143. import mx.controls.Alert;
  144. /**
  145. * 从服务器请示数据
  146. * */
  147. function loadDept():void{
  148. var remote:RemoteObject = new RemoteObject();
  149. remote.destination="flowServer";
  150. remote.endpoint="/ssh2-flex/messagebroker/amf";
  151. remote.getDeparts();
  152. remote.addEventListener(ResultEvent.RESULT,resultHander1);
  153. remote.addEventListener(FaultEvent.FAULT,fault);
  154. }
  155. /**
  156. * 请示成功后,调用的方法
  157. * */
  158. function resultHander1(event:ResultEvent):void{
  159. //在此只用转化为集合对象,不用考虑集合对象中的对象
  160. var list:ArrayCollection = event.result as ArrayCollection;
  161. this.deptList.dataProvider = list;
  162. }
  163. /**
  164. * 初 始化
  165. * */
  166. function init():void{
  167. var xmlArray:ArrayCollection = new ArrayCollection([
  168. {"name":"上海","selected":false,"children":[{"name":"黄浦","selected":false},
  169. {"name":"浦东","selected":false}]},
  170. {"name":"北京1","selected":false,"children":null}
  171. ]);
  172. //Tree对象默认会取chilren为子节点
  173.  
  174. deptList.dataProvider = xmlArray;
  175. }
  176.  
  177. /**
  178. * 出错后调用的方法
  179. * */
  180. function fault(event:FaultEvent):void{
  181. Alert.show("error");
  182. }
  183. /**
  184. * 双击调用的方法
  185. * */
  186. function showMsg():void{
  187. var st:String = deptList.selectedItem.id +" "+deptList.selectedItem.name;
  188. Alert.show(st);
  189. }
  190. ]]>
  191. </mx:Script>
  192. <mx:Label />
  193. <mx:HBox>
  194. <mx:Button label="加载数据" click="loadDept()" fontSize="" />
  195. <mx:Tree id="deptList" labelField="name" width="" height="" itemDoubleClick="showMsg()" />
  196. </mx:HBox>
  197. </mx:Application>
  198. 注:Java类加也可返回xml格的数据,供flex调用,具体请查看相关文档

Flex与SSH集成的更多相关文章

  1. java:Spring框架3(AOP,SSH集成Demo)

    1.AOP: Spring提供了4种实现AOP的方式: 1.经典的基于代理的AOP 2.@AspectJ注解驱动的切面 3.纯POJO切面 4.注入式AspectJ切面 aop.xml: <?x ...

  2. DWR以及SSH集成DWR

    之前只是单独接触了DWR,知道一个基本的开发流程. web.xml配置文件: <!-- 配置Dwr信息 -->  <servlet>   <servlet-name> ...

  3. SSH集成log4j日志环境[转]

    第一步:在web.xml初始化log4j <context-param> <param-name>log4jConfigLocation</param-name> ...

  4. SSH集成(Struts+Spring+Hibernate)

    环境:struts2.3.Xspring4.0.0hibernate4.2 思路:从下开始往上集成;层与层之间没有关系;在集成的时候,只关注当前集成的那个层的内容; 1,创建一个空的web项目;重新定 ...

  5. SSH集成log4j日志环境

    第一步:在web.xml初始化log4j <context-param> <param-name>contextConfigLocation</param-name> ...

  6. SSH集成cxf 发布restful webservice

    首先讲一下什么是restful webservice ,这个问题网上一搜有很多博文去长篇大论的介绍它,但是最后你看完了也会觉得云里雾里的,所以我在这里简单的讲一下我理解的rest webservice ...

  7. ssh集成

    导入pom依赖 <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w ...

  8. SSH集成开发框架开发步骤

    1.  环境搭建 a)添加Struts框架的支持 b)添加spring框架的支持(选中5个类库,且Copy类库到WEB-INF/lib目录下) c)在Eclipse 中,DataBase Explor ...

  9. SSH集成步骤

    1 在goodspeed.web.model下建立*类(空的构造,属性访问与设置),同时配置*.hbm.xml文件与数据库挂起来2 在goodspeed.web.dao建立*Dao和*Daoimpl类 ...

随机推荐

  1. oracle常用管理命令

    启动数据库和监听 lsnrctl start sqlplus /nolog conn sys/as sysdba startup  查看当前的实例名 show parameter instance_n ...

  2. NUC131演示如何通过PWM触发ADC。

    今天我来讲讲PWM触发ADC的例程 /**************************************************************************** * @f ...

  3. 定义了一个UIImageView如何使加载的图片不会失真 UIImageView的Frame值是固定的

    定义了一个UIImageView如何使加载的图片不会失真  UIImageView的Frame值是固定的 UIViewContentModeScaleToFill, 缩放内容到合适比例大小 UIVie ...

  4. .Net Core 使用EF Core方法

    新建项目后,使用NuGet安装包: Install-Package Microsoft.EntityFrameworkCore Install-Package Microsoft.EntityFram ...

  5. CSSOM视图模式(CSSOM View Module)

    一.Window视图属性(window对象) 这些属性可以获取住整个浏览器窗体大小.微软则将这些API称为“Screenview 接口” innerWidth 属性和 innerHeight 属性pa ...

  6. windows下的mysql迁移到linux下

    最近做毕业设计,需要把windows下的mysql移植到linux下 曾经有过在window下移植mysql数据库的经验,只需要把msql的数据文件复制到另一台安装mysql的机器的数据存放位置,然后 ...

  7. 【转】DevOps的前世今生

    转自:http://www.infoq.com/cn/news/2016/09/learn-devops-from-reports 目前在国外,互联网巨头如Google.Facebook.Amazon ...

  8. 在ScrollView嵌套GridView,使GridView不滚动

    <ScrollView>       ……   <LinearLayout> </LinearLayout>       ……</ScrollView> ...

  9. js中的颜色对应的常量代码code

    颜色的对照表 颜色 英文代码 形像颜色 HEX格式 RGB格式   LightPink 浅粉红 #FFB6C1 255,182,193   Pink 粉红 #FFC0CB 255,192,203   ...

  10. linux注意的一些地方

    assert宏的原型定义在<assert.h>中,其作用是如果它的条件返回错误,则终止程序执行 #include <assert.h>void assert( int expr ...