flex3提示mysql2_flex3+struts2+spring2+hibernate3+mysql(在web项目里面建flex,而不是flex工程)...

贴几个重要的文件

1。在原有的web项目中,添加flex步骤:

后面建工程就不要了。

2。新建web工程,把struts2+spring2+hibernate3的所有包,和所有配置文件写好。(这个做web开发

的都比较熟悉,在我的包里都有,就不说了)

--------接下来就是添加flex了。

右键点击工程名:如右图

1d36a24df98fb134e6ca06f6c8a0a76f.png

把flex工程加进去,在遇到新增完成的最后一步要记得取消“web.xml”那个选项。不然就覆盖了原来的web.xml了。

3。把blazeds(是在tomcat/webapp/你的项目下,你安装flex插件后,建flex工程时,要用到blazeds.war这个文件,当你启动tomcat的时候会自动生成blazeds文件夹)里面的几个xml文件放到工程里面。如下图

8bb397b9c4618fad976c146f4cbb7f41.png

4。修改web-xml文件,加入如下:

flex.messaging.HttpFlexSession

MessageBrokerServlet

flex.messaging.MessageBrokerServlet

services.configuration.file

/WEB-INF/flex/services-config.xml

1

MessageBrokerServlet

/messagebroker/*

5。修改remoting-config.xml(配置flex访问java类的标记)和services-config.xml(配置swf访问路径)

6。建立class文件,注意要有一个flex的映射文件以as结尾。

7。修改mxml文件。我的文件如下:

xmlns:locdg="com.flex.*"

creationComplete="initApp()"

minWidth="955" minHeight="600">

import com.shop.flex.GoodsFlex;

import com.shop.flex.DoubleClickDataGrid;

import mx.collections.ArrayCollection;

import mx.controls.Alert;

import mx.managers.CursorManager;

import mx.rpc.events.FaultEvent;

import mx.rpc.events.ResultEvent;

public var goodsFlex:GoodsFlex = new GoodsFlex();

public var result:Object = new Object();

[Bindable]

public var goods:ArrayCollection = new ArrayCollection();

public function initApp():void{

//   goodsdata.getGoodsList();

}

public function click_handler(event:Event):void{

CursorManager.setBusyCursor();

info.text = "正在查 询...";

goodsdata.getGoodsList();

}

public function onResult(event:ResultEvent):void{

goods = event.result as ArrayCollection;

CursorManager.removeBusyCursor();

if(goods.length==0){

info.text="取数据成功,为空";

//Alert.show("取数据成功,为空");

}else{

//info.text = " 取数据成功";

info.text = "取数据成功";

}

}

public function onFault(event:FaultEvent):void{

CursorManager.removeBusyCursor();

info.text="取数据失败";

//Alert.show("取数据失败");

}

public function addgoods_handler(event:Event):void{

if(goodsName.text != ""){

CursorManager.setBusyCursor();

goodsFlex.goodsName = goodsName.text;

addgoodsdata.addGoods(goodsFlex);

}else{

addinfo.text = "没有填写数据";

}

}

public function addResult(event:ResultEvent):void{

CursorManager.removeBusyCursor();

goodsdata.getGoodsList();

goodsName.text = "";

//Alert.show("添加成功");

addinfo.text = "添加成功";

//              info.text = "取数据成功";

}

public function addFault(event:FaultEvent):void{

CursorManager.removeBusyCursor();

addinfo.text = "新增失败";

}

public function deleteGoods(event:Event):void{

CursorManager.removeBusyCursor();

goodsFlex.goodsId = goods_data.selectedItem.goodsId;

deletegoodsdata.deleteGoods(goodsFlex);

}

public function deleteResult(event:ResultEvent):void{

CursorManager.removeBusyCursor();

goodsdata.getGoodsList();

//info.text = "刪除数据成 功";

}

public function deleteFault(event:FaultEvent):void{

CursorManager.removeBusyCursor();

//info.text="刪除数据失败";

}

public function updateGoods(event:Event):void{

if(goods_data.selectedItem.goodsName != ""){

CursorManager.setBusyCursor();

info.text = "正在 更新...";

goodsFlex.goodsId = goods_data.selectedItem.goodsId;

goodsFlex.goodsName = goods_data.selectedItem.goodsName;

updategoodsdata.updataGoods(goodsFlex);

}

}

public function updateResult(event:ResultEvent):void{

CursorManager.removeBusyCursor();

goodsdata.getGoodsList();

info.text = "修改数据成功";

}

public function updateFault(event:FaultEvent):void{

CursorManager.removeBusyCursor();

info.text="修改数据失败";

}

]]>

fontSize="12" borderStyle="inset" fontWeight="bold" textAlign="center" alternatingItemColors="[#F1B6B6, #F2EB37]" height="210" editable="true">

实现了增删改查的所有功能。如下图

09015ad6f73e2b0b55121dd91017dbce.png

我把工程放在文件下载里,lib比较大分4个rar放的,不明白联系QQ:654865674

dd6acdeab4bc7a601fbffbd7159a560a.png

大小: 12.7 KB

d0f5a4ddd7abdc641d7f0df21a2451c2.png

大小: 10.5 KB

873242e68b859f43236a1d666185f9eb.png

大小: 25.3 KB

下载次数: 326

lib3.rar (3.1 MB)

下载次数: 250

lib.rar (3.6 MB)

下载次数: 253

lib1.rar (7.9 MB)

下载次数: 297

lib2.rar (9.9 MB)

下载次数: 305

分享到:

18e900b8666ce6f233d25ec02f95ee59.png

72dd548719f0ace4d5f9bca64e1d7715.png

2011-03-16 15:39

浏览 1106

论坛回复 / 浏览 (7 / 6332)

评论

7 楼

qiyueguxing

2011-03-18

标题有点吓人,讲的就是flex bds 用法。

6 楼

elvishehai

2011-03-18

放在一个文件里吧,这样看很晕呀,

5 楼

chrislee1982

2011-03-18

晕!!

使用blazeds作远程访问,竟然是直接调用Dao?!

另外,如果使用了blazeds的话,根本没必要使用struts2了

楼主快改标题吧,免得被人笑死!

4 楼

rekoe.net

2011-03-18

哪里看到有sping的事!

3 楼

s929498110

2011-03-18

flex感觉不好用

我学了一段时间, 感觉除了对编程人员有好感外

对于用户,系统神马的都没有太大的用处, 在中国的网络上是不是flash更多啊?

flex刚出确实让编程人员耳目一新,比flash简单太多了,好感期一过,就各种问题出现

2 楼

hellostory

2011-03-18

这排版让人没有继续看下去的欲望...

1 楼

java_xiaoyi

2011-03-18

排版不咋的。。。。

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值