加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 百科 > 正文

flex如何与SSH通信

发布时间:2020-12-15 04:49:41 所属栏目:百科 来源:网络整理
导读:http://zhidao.baidu.com/question/278595325.html Step1: 准备开发环境 (1) 下载Blazedshttp://opensource.adobe.com/wiki/display/blazeds/Release+Builds选择下载Turnkey版本,因为自带了一些不错的例子,对学习Blazeds很有帮助。打开下载好的压缩包,

http://zhidao.baidu.com/question/278595325.html

Step1: 准备开发环境

(1) 下载Blazedshttp://opensource.adobe.com/wiki/display/blazeds/Release+Builds选择下载Turnkey版本,因为自带了一些不错的例子,对学习Blazeds很有帮助。打开下载好的压缩包,找到blazeds.war包,这就是我们真正需要的文件。

(2) 下载Blazeds调用Spring组件http://www.adobe.com/devnet/livecycle/articles/blazeds_spring.html下载Sample files,打开下载好的压缩包,factorysrcflexsamplesfactories路径的SpringFactory.java就是我们需要的组件。

Step2: 配置project

(1) 配置Spring和Hibernate

(2) 配置web.xml解压blazeds.war,打开WEB-INF目录下的web.xml,将下面这段代码拷贝到后台工程的WEB-INF/web.xml中<!-- Http Flex Session attribute and binding listener support --><listener> <listener-class> flex.messaging.HttpFlexSession </listener-class></listener><!-- MessageBroker Servlet --><servlet> <servlet-name>MessageBrokerServlet</servlet-name> <display-name>MessageBrokerServlet</display-name> <servlet-class> flex.messaging.MessageBrokerServlet </servlet-class> <init-param> <param-name> services.configuration.file </param-name> <param-value> /WEB-INF/flex/services-config.xml </param-value> </init-param> <load-on-startup>1</load-on-startup></servlet><servlet-mapping> <servlet-name>MessageBrokerServlet</servlet-name> <url-pattern>/messagebroker/*</url-pattern></servlet-mapping>

(3) 配置Blazeds解压blazeds.war,将lib目录中的jar包拷贝到后台工程目录下的lib目录下,将flex目录拷贝到后台工程WEB-INF目录下

(4) 配置SpringFactory将在Step1第二步骤中找到的SpringFactory.java拷贝到相应的package下,然后打开WEB-INF/flex/services-config.xml,添加下面的配置:<factories> <factory id="spring" class="xxx.xxx.SpringFactory"/> </factories>

(5) 配置remoting-config.xml打开WEB-INF/flex/services-config.xml,添加下面的配置:<destination id="productService"> <properties> <factory>spring</factory> <!-- source对应的是bean的id --> <source>xxxxx</source> </properties></destination>

Step3: Flex端调用

(1) 添加RemoteObject

<mx:RemoteObject id="rbt" destination="productService" endpoint="/xxxxxx/messagebroker/amf"> <!-- xxxxxx一般为后台工程名 -->

????????? <mx:method name="createProduct" result="resultCreateProduct(event)" fault="faultCreateProduct(event)"/>

</mx:RemoteObject>

(2) 调用RemoteObject

rbt.createProduct(product);

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读