Flex与SSH集成
Flex与SSH集成 -- ::| 分类: flex |举报|字号 订阅
Flex与SSH集成
,下载blazeds_bin_3---.zip 包,将其解压 取下blazeds.war包 更改为blazeds.rar ,并解压
将上一步解压的web-inf/lib/下的包复制到工程的lib下
,将flex文件夹 复制到工程的web-inf下
将classes下的文件复制到工程的src下
5在web.xml中加入 <!-- flex -->
<servlet>
<servlet-name>flex</servlet-name>
<servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
<init-param>
<param-name>contextConfigLocation</param-name>
<param-value>/WEB-INF/classes/flex-application-config.xml</param-value>
</init-param>
<load-on-startup></load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>flex</servlet-name>
<url-pattern>/ssh/*</url-pattern>
</servlet-mapping>
<!-- end flex -->
6,在src下建一个flex-application-config.xml文件
加入
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:flex="http://www.springframework.org/schema/flex"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="
http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
http://www.springframework.org/schema/flex
http://www.springframework.org/schema/flex/spring-flex-1.0.xsd">
<flex:message-broker/>
<!— 下面是表示 在spring配置文件中配置的bean-->
<flex:remoting-destination ref="flowServer"/>
</beans>
以下内容
6,加入flex与spring所依赖的包
Flex与SSH集成 - 花落谁家 - zhangcb666的博客 7 编写 java 类 1> 编写类体DeptNode.class package com.svse.entity.bean; import java.util.ArrayList;
import java.util.List;
/***
* 注: 此类可以不用和Flex映射 ,因为在Flex端,我们不用把Object对象强转为此对象
**/
public class DeptNode { private int id;
private String name;
private DeptNode parent; private List<DeptNode> children = null; public DeptNode(){}
public DeptNode(int id ,String name){
this.id = id;
this.name = name;
}
/*************get and set 省略****************/ }
> 编写接口IflowServer.class
package com.svse.server; import java.util.List;
import com.svse.entity.bean.DeptNode; public interface IFlowServer {
//得到部门
List<DeptNode> getDeparts(int deptId);
} > 编写实现类
package com.svse.server.impl; import java.util.List; import com.svse.entity.bean.DeptNode;
import com.svse.server.IFlowServer; public class FlowServer implements IFlowServer { //得到部门
public List<DeptNode> getDeparts(int deptId){
List<DeptNode> list = new ArrayList<DeptNode>();
DeptNode node = new DeptNode();
node.setId();
node.setName("父节点11");
node.setChildren(this.getChild(, "aa")); list.add(node); DeptNode node2= new DeptNode();
node2.setId();
node2.setName("父节点22");
node2.setChildren(this.getChild(, "bb")); list.add(node2); return list;
} private List<DeptNode> getChild(int count,String name){
List<DeptNode> list = new ArrayList<DeptNode>();
for(int i = ; i < count; i++){
DeptNode node3 = new DeptNode();
node3.setId(i);
node3.setName(name+""+i);
list.add(node3);
}
return list;
} }
} 在spring中注入
<bean id="flowServer" class="com.svse.server.impl.FlowServer"/>
注:此处的Id,就是在flex-application-config.xml中的
<flex:remoting-destination ref="flowServer"/>配置的ref值 编写flex代码 <?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" creationComplete="init()">
<mx:Script>
<![CDATA[
import mx.rpc.remoting.mxml.RemoteObject;
import bean.FileAction;
import mx.collections.ArrayCollection;
import mx.rpc.events.FaultEvent;
import mx.rpc.events.ResultEvent;
import mx.controls.Alert;
/**
* 从服务器请示数据
* */
function loadDept():void{
var remote:RemoteObject = new RemoteObject();
remote.destination="flowServer";
remote.endpoint="/ssh2-flex/messagebroker/amf";
remote.getDeparts();
remote.addEventListener(ResultEvent.RESULT,resultHander1);
remote.addEventListener(FaultEvent.FAULT,fault);
}
/**
* 请示成功后,调用的方法
* */
function resultHander1(event:ResultEvent):void{
//在此只用转化为集合对象,不用考虑集合对象中的对象
var list:ArrayCollection = event.result as ArrayCollection;
this.deptList.dataProvider = list;
}
/**
* 初 始化
* */
function init():void{
var xmlArray:ArrayCollection = new ArrayCollection([
{"name":"上海","selected":false,"children":[{"name":"黄浦","selected":false},
{"name":"浦东","selected":false}]},
{"name":"北京1","selected":false,"children":null}
]);
//Tree对象默认会取chilren为子节点 deptList.dataProvider = xmlArray;
} /**
* 出错后调用的方法
* */
function fault(event:FaultEvent):void{
Alert.show("error");
}
/**
* 双击调用的方法
* */
function showMsg():void{
var st:String = deptList.selectedItem.id +" "+deptList.selectedItem.name;
Alert.show(st);
}
]]>
</mx:Script>
<mx:Label />
<mx:HBox>
<mx:Button label="加载数据" click="loadDept()" fontSize="" />
<mx:Tree id="deptList" labelField="name" width="" height="" itemDoubleClick="showMsg()" />
</mx:HBox>
</mx:Application>
注:Java类加也可返回xml格的数据,供flex调用,具体请查看相关文档
Flex与SSH集成的更多相关文章
- java:Spring框架3(AOP,SSH集成Demo)
1.AOP: Spring提供了4种实现AOP的方式: 1.经典的基于代理的AOP 2.@AspectJ注解驱动的切面 3.纯POJO切面 4.注入式AspectJ切面 aop.xml: <?x ...
- DWR以及SSH集成DWR
之前只是单独接触了DWR,知道一个基本的开发流程. web.xml配置文件: <!-- 配置Dwr信息 --> <servlet> <servlet-name> ...
- SSH集成log4j日志环境[转]
第一步:在web.xml初始化log4j <context-param> <param-name>log4jConfigLocation</param-name> ...
- SSH集成(Struts+Spring+Hibernate)
环境:struts2.3.Xspring4.0.0hibernate4.2 思路:从下开始往上集成;层与层之间没有关系;在集成的时候,只关注当前集成的那个层的内容; 1,创建一个空的web项目;重新定 ...
- SSH集成log4j日志环境
第一步:在web.xml初始化log4j <context-param> <param-name>contextConfigLocation</param-name> ...
- SSH集成cxf 发布restful webservice
首先讲一下什么是restful webservice ,这个问题网上一搜有很多博文去长篇大论的介绍它,但是最后你看完了也会觉得云里雾里的,所以我在这里简单的讲一下我理解的rest webservice ...
- ssh集成
导入pom依赖 <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w ...
- SSH集成开发框架开发步骤
1. 环境搭建 a)添加Struts框架的支持 b)添加spring框架的支持(选中5个类库,且Copy类库到WEB-INF/lib目录下) c)在Eclipse 中,DataBase Explor ...
- SSH集成步骤
1 在goodspeed.web.model下建立*类(空的构造,属性访问与设置),同时配置*.hbm.xml文件与数据库挂起来2 在goodspeed.web.dao建立*Dao和*Daoimpl类 ...
随机推荐
- tableView删除功能小记
由于项目需要,做一个UITableView来实现删除功能. 效果如图: 功能思路其实不难: 交代一下,我自己要实现的效果: 1.TableView是分组的. 2.点击删除按钮后,某行被删除. 写完 ...
- 教程Xcode 下编译发布与提交App到AppStore
The proplem of Prepare for Upload for App store upload Application App store 增加新应用的步骤. 1. 访问iTunesCo ...
- Android 权限信息
访问登记属性 android.permission.ACCESS_CHECKIN_PROPERTIES ,读取或写入登记check-in数据库属性表的权限 获取错略位置 android.permiss ...
- Js跨域、父级窗口执行JS赋值、取值,更改元素
网站域名: A:http://www.xxoo.com/a.html B:http://www.aabb.com/b.html B网站嵌套与A网站(A的a中的Iframe指向B中的b)b要让父级a页面 ...
- 使用commons-email解析 eml文件
在对eml文件进行索引的时候需要先对其进行解析,提取出其中的收件人.发件人.文件内容和附件等信息 下边是解析eml文件的一个demo(在运行之前需要先导入mail.jar 和commons-email ...
- 几何+点与线段的位置关系+二分(POJ2318)
TOYS Time Limit: 2000MS Memory Limit: 65536K Total Submissions: 10666 Accepted: 5128 Description ...
- fiddler win10-1703Failed to register Fiddler as the system proxy
正解 The solution for the Fiddler error of "Failed to register Fiddler as the system proxy" ...
- Guava增强for循环
Guava的前身是Google Collections,是Google开发出的一个开源Java常用类库,包含了一些集合的便捷操作API.本文通过一些常用的例子来剖析Guava的奇妙之处. Guava是 ...
- vs 2015
基于应用要求和要使用的语言选择所需工具. Xamarin for Visual Studio:针对所有设备的 C# 中的常用基本代码 Apache Cordova with Visual Studio ...
- jQuery 的attr()方法
在JS中设置节点的属性与属性值用到setAttribute(),获得节点的属性与属性值用到getAttribute(),而在jquery中,用一个attr()就可以全部搞定了,赞一个先 ^^ jque ...