- 浏览: 104866 次
- 性别:
- 来自: 南充
最新评论
-
zhangzi:
你这是hibernate hql分页
hibernate SQL 分页查询 -
edwardjj1234:
listMyArticle.action这个文件能否说明一下? ...
ssh2分页例子 -
edwardjj1234:
前台页面显示不用c;foreach吗?是在哪里控制页面输出数量 ...
ssh2分页例子 -
yangqjiayou:
大哥,代码传给我一份呗,加上数据库文件哈,谢谢啦3466598 ...
ssh2分页例子 -
wangshunfan:
楼主,在MemberDaoImpl类中
return getH ...
ssh2分页例子
1下载支持文件flex-spring.zip
新建FlexLCDS工程File -> new -> Flex Project 这里不细说这个。请看http://nic.iteye.com/blog/247604
前端是flex.中间层使用spring接着hibernate,spring+hibernate的集成方法和j2ee的项目中方法相同
修改WEB-INF\web.xml ,加入下面代码
Xml代码
<listener>
<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
</listener>
<listener>
<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
</listener>
注册sping factory,
修改WEB-INF\flex配置
<factory id="springFactory" class="cn.org.coral.core.flex.factory.FlexSpringFactory" />
Class属性填写第一步中考入项目SpringFactory类的路径
3 注册bean到remoting-config.xml
Xml代码
<destination id="teacherDao">
<properties>
<factory>springFactory</factory>
<source>TeacherDAO</source>
</properties>
</destination>
<destination id="teacherDao">
<properties>
<factory>springFactory</factory>
<source>TeacherDAO</source>
</properties>
</destination>
编写SpringFactory.java
Java代码
public class FlexSpringFactory implements FlexFactory {
public FactoryInstance createFactoryInstance(String id, ConfigMap properties) {
SpringFactoryInstance instance = new SpringFactoryInstance(this, id, properties);
instance.setSource(properties.getPropertyAsString(SOURCE, instance.getId()));
return instance;
}
public Object lookup(FactoryInstance inst) {
SpringFactoryInstance factoryInstance = (SpringFactoryInstance) inst;
return factoryInstance.lookup();
}
public void initialize(String arg0, ConfigMap arg1) {
}
}
public class SpringFactoryInstance extends FactoryInstance
{
public SpringFactoryInstance(FlexSpringFactory factory, String id, ConfigMap properties)
{
super(factory, id, properties);
}
public Object lookup()
{
ApplicationContext appContext = WebApplicationContextUtils.getWebApplicationContext(flex.messaging.FlexContext.getServletConfig().getServletContext());
String beanName = getSource();
try
{
return appContext.getBean(beanName);
}
catch (NoSuchBeanDefinitionException nexc)
{
ServiceException e = new ServiceException();
throw e;
}
catch (BeansException bexc)
{
ServiceException e = new ServiceException();
throw e;
}
}
public class FlexSpringFactory implements FlexFactory {
public FactoryInstance createFactoryInstance(String id, ConfigMap properties) {
SpringFactoryInstance instance = new SpringFactoryInstance(this, id, properties);
instance.setSource(properties.getPropertyAsString(SOURCE, instance.getId()));
return instance;
}
public Object lookup(FactoryInstance inst) {
SpringFactoryInstance factoryInstance = (SpringFactoryInstance) inst;
return factoryInstance.lookup();
}
public void initialize(String arg0, ConfigMap arg1) {
}
}
public class SpringFactoryInstance extends FactoryInstance
{
public SpringFactoryInstance(FlexSpringFactory factory, String id, ConfigMap properties)
{
super(factory, id, properties);
}
public Object lookup()
{
ApplicationContext appContext = WebApplicationContextUtils.getWebApplicationContext(flex.messaging.FlexContext.getServletConfig().getServletContext());
String beanName = getSource();
try
{
return appContext.getBean(beanName);
}
catch (NoSuchBeanDefinitionException nexc)
{
ServiceException e = new ServiceException();
throw e;
}
catch (BeansException bexc)
{
ServiceException e = new ServiceException();
throw e;
}
}
login.mxml
Xml代码
<?xml version="1.0" encoding="utf-8"?>
<mx:TitleWindow xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" width="326" height="162" title="登录" horizontalAlign="center" verticalAlign="middle">
<mx:RemoteObject id="loginDao" destination="teacherDao"/>
<mx:Script>
<![CDATA[
import As.bean.Teacher;
import mx.rpc.events.FaultEvent;
import mx.managers.PopUpManager;
import mx.rpc.events.ResultEvent;
import mx.controls.Alert;
public var userId:Label;
public var userName:Label;
public var sex:Label;
public var birth:Label;
public var department:Label;
public var profession:Label;
public var mobile:Label;
public var teacher:Teacher;
private function callRO(str:String,psw:String):void{
var t:Teacher=new Teacher();
t.loginname=str;
t.loginpass=psw;
loginDao.Login(t);
loginDao.addEventListener(ResultEvent.RESULT,getROResult);
loginDao.addEventListener(FaultEvent.FAULT,getError);
}
private function getError(e:FaultEvent):void{
Alert.show(e.message.toString());
}
private function getROResult(e:ResultEvent) :void {
if(e.result.loginname=="error"){
tip.text="No such user!! ";
}else
{
teacher=e.result as Teacher;
sex.text=e.result.sex;
userId.text=e.result.id;
userName.text=e.result.name;
birth.text=e.result.birth;
department.text=e.result.department;
profession.text=e.result.profession;
mobile.text=e.result.mobile;
proccessLogin();
}
}
private function proccessLogin():void{
PopUpManager.removePopUp(this);
}
]]>
</mx:Script>
<mx:Label x="34" y="33" text="用户"/>
<mx:TextInput x="77" y="31" id="userNameTxt"/>
<mx:Label x="34" y="61" text="密码"/>
<mx:TextInput x="77" y="59" displayAsPassword="true" id="psw"/>
<mx:Button x="77" y="90" label="登录" click="callRO(userNameTxt.text,psw.text);"/>
<mx:Label x="163" y="94" id="tip" color="red"/>
</mx:TitleWindow>
<?xml version="1.0" encoding="utf-8"?>
<mx:TitleWindow xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" width="326" height="162" title="登录" horizontalAlign="center" verticalAlign="middle">
<mx:RemoteObject id="loginDao" destination="teacherDao"/>
<mx:Script>
<![CDATA[
import As.bean.Teacher;
import mx.rpc.events.FaultEvent;
import mx.managers.PopUpManager;
import mx.rpc.events.ResultEvent;
import mx.controls.Alert;
public var userId:Label;
public var userName:Label;
public var sex:Label;
public var birth:Label;
public var department:Label;
public var profession:Label;
public var mobile:Label;
public var teacher:Teacher;
private function callRO(str:String,psw:String):void{
var t:Teacher=new Teacher();
t.loginname=str;
t.loginpass=psw;
loginDao.Login(t);
loginDao.addEventListener(ResultEvent.RESULT,getROResult);
loginDao.addEventListener(FaultEvent.FAULT,getError);
}
private function getError(e:FaultEvent):void{
Alert.show(e.message.toString());
}
private function getROResult(e:ResultEvent) :void {
if(e.result.loginname=="error"){
tip.text="No such user!! ";
}else
{
teacher=e.result as Teacher;
sex.text=e.result.sex;
userId.text=e.result.id;
userName.text=e.result.name;
birth.text=e.result.birth;
department.text=e.result.department;
profession.text=e.result.profession;
mobile.text=e.result.mobile;
proccessLogin();
}
}
private function proccessLogin():void{
PopUpManager.removePopUp(this);
}
]]>
</mx:Script>
<mx:Label x="34" y="33" text="用户"/>
<mx:TextInput x="77" y="31" id="userNameTxt"/>
<mx:Label x="34" y="61" text="密码"/>
<mx:TextInput x="77" y="59" displayAsPassword="true" id="psw"/>
<mx:Button x="77" y="90" label="登录" click="callRO(userNameTxt.text,psw.text);"/>
<mx:Label x="163" y="94" id="tip" color="red"/>
</mx:TitleWindow>
applicationcontext.xml
Xml代码
<bean id="TeacherDAO" class="com.source.bean.TeacherDAO">
<property name="sessionFactory">
<ref bean="sessionFactory" />
</property>
</bean>
新建FlexLCDS工程File -> new -> Flex Project 这里不细说这个。请看http://nic.iteye.com/blog/247604
前端是flex.中间层使用spring接着hibernate,spring+hibernate的集成方法和j2ee的项目中方法相同
修改WEB-INF\web.xml ,加入下面代码
Xml代码
<listener>
<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
</listener>
<listener>
<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
</listener>
注册sping factory,
修改WEB-INF\flex配置
<factory id="springFactory" class="cn.org.coral.core.flex.factory.FlexSpringFactory" />
Class属性填写第一步中考入项目SpringFactory类的路径
3 注册bean到remoting-config.xml
Xml代码
<destination id="teacherDao">
<properties>
<factory>springFactory</factory>
<source>TeacherDAO</source>
</properties>
</destination>
<destination id="teacherDao">
<properties>
<factory>springFactory</factory>
<source>TeacherDAO</source>
</properties>
</destination>
编写SpringFactory.java
Java代码
public class FlexSpringFactory implements FlexFactory {
public FactoryInstance createFactoryInstance(String id, ConfigMap properties) {
SpringFactoryInstance instance = new SpringFactoryInstance(this, id, properties);
instance.setSource(properties.getPropertyAsString(SOURCE, instance.getId()));
return instance;
}
public Object lookup(FactoryInstance inst) {
SpringFactoryInstance factoryInstance = (SpringFactoryInstance) inst;
return factoryInstance.lookup();
}
public void initialize(String arg0, ConfigMap arg1) {
}
}
public class SpringFactoryInstance extends FactoryInstance
{
public SpringFactoryInstance(FlexSpringFactory factory, String id, ConfigMap properties)
{
super(factory, id, properties);
}
public Object lookup()
{
ApplicationContext appContext = WebApplicationContextUtils.getWebApplicationContext(flex.messaging.FlexContext.getServletConfig().getServletContext());
String beanName = getSource();
try
{
return appContext.getBean(beanName);
}
catch (NoSuchBeanDefinitionException nexc)
{
ServiceException e = new ServiceException();
throw e;
}
catch (BeansException bexc)
{
ServiceException e = new ServiceException();
throw e;
}
}
public class FlexSpringFactory implements FlexFactory {
public FactoryInstance createFactoryInstance(String id, ConfigMap properties) {
SpringFactoryInstance instance = new SpringFactoryInstance(this, id, properties);
instance.setSource(properties.getPropertyAsString(SOURCE, instance.getId()));
return instance;
}
public Object lookup(FactoryInstance inst) {
SpringFactoryInstance factoryInstance = (SpringFactoryInstance) inst;
return factoryInstance.lookup();
}
public void initialize(String arg0, ConfigMap arg1) {
}
}
public class SpringFactoryInstance extends FactoryInstance
{
public SpringFactoryInstance(FlexSpringFactory factory, String id, ConfigMap properties)
{
super(factory, id, properties);
}
public Object lookup()
{
ApplicationContext appContext = WebApplicationContextUtils.getWebApplicationContext(flex.messaging.FlexContext.getServletConfig().getServletContext());
String beanName = getSource();
try
{
return appContext.getBean(beanName);
}
catch (NoSuchBeanDefinitionException nexc)
{
ServiceException e = new ServiceException();
throw e;
}
catch (BeansException bexc)
{
ServiceException e = new ServiceException();
throw e;
}
}
login.mxml
Xml代码
<?xml version="1.0" encoding="utf-8"?>
<mx:TitleWindow xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" width="326" height="162" title="登录" horizontalAlign="center" verticalAlign="middle">
<mx:RemoteObject id="loginDao" destination="teacherDao"/>
<mx:Script>
<![CDATA[
import As.bean.Teacher;
import mx.rpc.events.FaultEvent;
import mx.managers.PopUpManager;
import mx.rpc.events.ResultEvent;
import mx.controls.Alert;
public var userId:Label;
public var userName:Label;
public var sex:Label;
public var birth:Label;
public var department:Label;
public var profession:Label;
public var mobile:Label;
public var teacher:Teacher;
private function callRO(str:String,psw:String):void{
var t:Teacher=new Teacher();
t.loginname=str;
t.loginpass=psw;
loginDao.Login(t);
loginDao.addEventListener(ResultEvent.RESULT,getROResult);
loginDao.addEventListener(FaultEvent.FAULT,getError);
}
private function getError(e:FaultEvent):void{
Alert.show(e.message.toString());
}
private function getROResult(e:ResultEvent) :void {
if(e.result.loginname=="error"){
tip.text="No such user!! ";
}else
{
teacher=e.result as Teacher;
sex.text=e.result.sex;
userId.text=e.result.id;
userName.text=e.result.name;
birth.text=e.result.birth;
department.text=e.result.department;
profession.text=e.result.profession;
mobile.text=e.result.mobile;
proccessLogin();
}
}
private function proccessLogin():void{
PopUpManager.removePopUp(this);
}
]]>
</mx:Script>
<mx:Label x="34" y="33" text="用户"/>
<mx:TextInput x="77" y="31" id="userNameTxt"/>
<mx:Label x="34" y="61" text="密码"/>
<mx:TextInput x="77" y="59" displayAsPassword="true" id="psw"/>
<mx:Button x="77" y="90" label="登录" click="callRO(userNameTxt.text,psw.text);"/>
<mx:Label x="163" y="94" id="tip" color="red"/>
</mx:TitleWindow>
<?xml version="1.0" encoding="utf-8"?>
<mx:TitleWindow xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" width="326" height="162" title="登录" horizontalAlign="center" verticalAlign="middle">
<mx:RemoteObject id="loginDao" destination="teacherDao"/>
<mx:Script>
<![CDATA[
import As.bean.Teacher;
import mx.rpc.events.FaultEvent;
import mx.managers.PopUpManager;
import mx.rpc.events.ResultEvent;
import mx.controls.Alert;
public var userId:Label;
public var userName:Label;
public var sex:Label;
public var birth:Label;
public var department:Label;
public var profession:Label;
public var mobile:Label;
public var teacher:Teacher;
private function callRO(str:String,psw:String):void{
var t:Teacher=new Teacher();
t.loginname=str;
t.loginpass=psw;
loginDao.Login(t);
loginDao.addEventListener(ResultEvent.RESULT,getROResult);
loginDao.addEventListener(FaultEvent.FAULT,getError);
}
private function getError(e:FaultEvent):void{
Alert.show(e.message.toString());
}
private function getROResult(e:ResultEvent) :void {
if(e.result.loginname=="error"){
tip.text="No such user!! ";
}else
{
teacher=e.result as Teacher;
sex.text=e.result.sex;
userId.text=e.result.id;
userName.text=e.result.name;
birth.text=e.result.birth;
department.text=e.result.department;
profession.text=e.result.profession;
mobile.text=e.result.mobile;
proccessLogin();
}
}
private function proccessLogin():void{
PopUpManager.removePopUp(this);
}
]]>
</mx:Script>
<mx:Label x="34" y="33" text="用户"/>
<mx:TextInput x="77" y="31" id="userNameTxt"/>
<mx:Label x="34" y="61" text="密码"/>
<mx:TextInput x="77" y="59" displayAsPassword="true" id="psw"/>
<mx:Button x="77" y="90" label="登录" click="callRO(userNameTxt.text,psw.text);"/>
<mx:Label x="163" y="94" id="tip" color="red"/>
</mx:TitleWindow>
applicationcontext.xml
Xml代码
<bean id="TeacherDAO" class="com.source.bean.TeacherDAO">
<property name="sessionFactory">
<ref bean="sessionFactory" />
</property>
</bean>
发表评论
-
江哥读:创业者必看(马云语录)
2011-05-22 11:16 915不要因为别人的一句话 ... -
LOG4J的配置..实现了输出到控制台、文件、回滚文件、发送日志邮件
2011-01-25 10:28 1406Log4J配置文件实现了输出到控制台、文件、回滚文件、发送 ... -
IE6中用了float:left之后导致margin-left双倍边距的BUG解决方法
2011-01-18 14:32 2782先看css代码:div { float:left; ... -
Hibernate三大类查询总结
2010-07-24 21:15 13930Hibernate目前总共分为三大类查询:cretiria, ... -
JAVA认证考试历年经典面试题目整理
2010-07-23 20:55 8571. java中的异常处理机制的简单和应用。 当Java程序 ... -
JAVA SSH框架
2010-07-23 20:53 2125JAVA SSH框架 JAVA SSH框架在Struts + ... -
Spring Security 安全框架
2010-06-02 13:19 883http://www.family168.com/oa/spr ... -
Eclipse快捷键
2010-05-27 09:52 785Eclipse 快捷键(1) Ctrl+1 快 ... -
Hibernate查询Query By Criterial
2010-05-25 19:35 1751提供的检索方式:(1) ... -
DispatchAction, LookupDispatchAction, MappingDispatchAction深入分析
2010-04-29 18:29 950首先我们来看一下它们三者之间的关系 java.lang.Obj ... -
FCKeditor在struts2中无法上传文件的解决办法
2010-03-31 20:44 1154最近有个项目使用struts2进行开发,同时使用了FCKEdi ... -
java备份和恢复mysql数据库
2010-02-27 12:00 1020package cwnu.cs.ncjzwms.utils; ... -
tomcat设置虚拟域名
2010-01-04 17:17 2161在$tomcat/webapps/下建了个myjsp目录作为我 ... -
mysql数据库同步
2009-12-24 17:16 12411、简要介绍:mysql从3.23.15版本以后提供数据库复制 ... -
http://fykyx521.javaeye.com/blog/517138
2009-11-17 10:20 734http://fykyx521.iteye.com/blog/ ... -
163编辑器
2009-10-31 20:50 1771163Editor编辑器的源代码 ... -
Flex 修改浏览器页面标题
2009-10-12 20:38 2968修改浏览器页面标题2009-01-16 16:23浏览器页面的 ... -
PHP连接数据库
2009-10-02 15:47 918<!DOCTYPE html PUBLIC " ... -
FLEX和Spring、Hibernate的集成 - Flex+Spring
2009-09-25 11:22 1195remoting-config.xml:<destina ... -
ssh2分页例子
2009-09-11 23:37 16198分页显示一直是web开发 ...
相关推荐
hibernate+flex+spring 整合,hibernate+flex+spring 集成
自己写的Flex+spring+hibernate示例,精简易懂
Flex+Spring+Hibernate 整合的方式有多种,本文是利用flex builder插件,将flex与javaEE服务器端整合到一个工程里面,以便程序员可以在一个IDE里完成开发。
使用flex 4.5 + Spring 3.0 + Hibernate 3.3 + Cairngorm 2.2.1 + BlazeDS 3.3.0 + Spring BlazeDS Integration 1.0.3整合出的一个登录的小demo·
用flex+spring+hibernate整合的一个小小的登陆实例,希望对学习flex+java通信开发的有点帮助吧
Flex PureMVC Flex BlazeDS Spring Hibernate 整合 里面一些图标是包双击可查看源代码
MyEclipse7.5+flex4+spring3.0.5+struts2.2.1+hibernate3.6.0+blazeds4.0.0.14931完美整合方案 内附所需jar包和源代码
Flex+spring+hibernate视屏,Flex+spring+hibernate视屏
flex+spring+hibernate+mysql
flex+bleazeds+spring+hibernate的整合,中文版简单易懂
Flex+spring+hibernate框架配置详解啊,包含源文件的
使用Flex Builder+MyEclipse搭建的Flex+Spring+Hibernate环境,写了一个简单的登录,可以实现前台到后台,后台回到前台的基本流程,懒着搭建环境的人可以直接部署运行。
配置flex+bleazeds+spring+hibernate
flex+java+spring+hibernate+blazeds整合
花了四天终于搭好flex+spring+hibernate。。。 我是初学者。。希望多点交流
此案例用到的框架是Flex+BlazeDS+Spring+Hibernate完成了三个案例的整合,用到的数据库脚本已经在项目中。只需要加压,在软件中导入,执行数据库脚本,项目就可以运行。
跟我一步步搭建 PureMVC+Flex+BlazeDS+Spring+Hibernate
flex+eclipse+spring+hibernate整合
flex整合hibernate,spring,详细配置
flex+cairgorm+hibernate+spring项目配置源码