- 浏览: 107564 次
- 性别:
- 来自: 南充
最新评论
-
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 1017不要因为别人的一句话 ... -
LOG4J的配置..实现了输出到控制台、文件、回滚文件、发送日志邮件
2011-01-25 10:28 1439Log4J配置文件实现了输出到控制台、文件、回滚文件、发送 ... -
IE6中用了float:left之后导致margin-left双倍边距的BUG解决方法
2011-01-18 14:32 2834先看css代码:div { float:left; ... -
Hibernate三大类查询总结
2010-07-24 21:15 14012Hibernate目前总共分为三大类查询:cretiria, ... -
JAVA认证考试历年经典面试题目整理
2010-07-23 20:55 8841. java中的异常处理机制的简单和应用。 当Java程序 ... -
JAVA SSH框架
2010-07-23 20:53 2191JAVA SSH框架 JAVA SSH框架在Struts + ... -
Spring Security 安全框架
2010-06-02 13:19 983http://www.family168.com/oa/spr ... -
Eclipse快捷键
2010-05-27 09:52 842Eclipse 快捷键(1) Ctrl+1 快 ... -
Hibernate查询Query By Criterial
2010-05-25 19:35 1851提供的检索方式:(1) ... -
DispatchAction, LookupDispatchAction, MappingDispatchAction深入分析
2010-04-29 18:29 996首先我们来看一下它们三者之间的关系 java.lang.Obj ... -
FCKeditor在struts2中无法上传文件的解决办法
2010-03-31 20:44 1205最近有个项目使用struts2进行开发,同时使用了FCKEdi ... -
java备份和恢复mysql数据库
2010-02-27 12:00 1043package cwnu.cs.ncjzwms.utils; ... -
tomcat设置虚拟域名
2010-01-04 17:17 2205在$tomcat/webapps/下建了个myjsp目录作为我 ... -
mysql数据库同步
2009-12-24 17:16 12761、简要介绍:mysql从3.23.15版本以后提供数据库复制 ... -
http://fykyx521.javaeye.com/blog/517138
2009-11-17 10:20 818http://fykyx521.iteye.com/blog/ ... -
163编辑器
2009-10-31 20:50 1877163Editor编辑器的源代码 ... -
Flex 修改浏览器页面标题
2009-10-12 20:38 3019修改浏览器页面标题2009-01-16 16:23浏览器页面的 ... -
PHP连接数据库
2009-10-02 15:47 971<!DOCTYPE html PUBLIC " ... -
FLEX和Spring、Hibernate的集成 - Flex+Spring
2009-09-25 11:22 1243remoting-config.xml:<destina ... -
ssh2分页例子
2009-09-11 23:37 16268分页显示一直是web开发 ...
相关推荐
综上所述,这个示例项目将教给开发者如何将Flex的富客户端体验与Spring的后端服务和Hibernate的数据管理相结合,形成一个完整的、功能强大的Web应用。开发者可以通过学习这个示例,理解如何设置BlazeDS以实现实时...
Flex+Spring+Hibernate 整合是企业级应用开发中常见的一种技术栈组合,它结合了Flex前端的富互联网...通过以上步骤,开发者可以搭建一个完整的Flex+Spring+Hibernate开发环境,为复杂的企业级应用开发提供坚实的基础。
这些步骤详细指导了如何逐步建立一个功能齐全的Flex应用,该应用能够通过BlazeDS与Spring服务通信,并利用Hibernate与数据库交互。 在实际的开发过程中,这种整合提供了强大的功能,包括灵活的用户界面设计、高效的...
使用flex 4.5 + Spring 3.0 + Hibernate 3.3 + Cairngorm 2.2.1 + BlazeDS 3.3.0 + Spring BlazeDS Integration 1.0.3整合出的一个登录的小demo·
在IT行业中,整合Hibernate、Flex和Spring框架是一个常见的任务,以构建高效、用户交互性强的Web应用程序。这个组合允许开发者利用Hibernate的ORM能力处理数据库操作,Flex的富互联网应用程序(RIA)界面,以及...
这个项目结合了前端的Flex(一种基于ActionScript和Flash的RIA开发框架)与后端的Spring(一个全面的Java应用框架)、Hibernate(一个对象关系映射框架)以及MySQL(一个流行的开源关系型数据库),实现了一个完整的...
本方案提供了一种集成化的开发环境,即"MyEclipse7.5+flex4+spring3.0.5+struts2.2.1+hibernate3.6.0+blazeds4.0.0.14931完美整合方案",它将多个流行的技术框架整合在一起,为Web应用程序开发提供了一个强大的平台...
Flex+Spring+Hibernate环境是基于Adobe Flex前端、Spring框架作为服务层、Hibernate作为持久层的集成开发环境。这种组合在Web应用开发中被广泛应用,因为它提供了丰富的用户界面、强大的业务逻辑处理以及高效的...
整合 Flex、Hibernate 和 Spring 的目标是构建一个前端界面精美、后端数据处理强大的Web应用。下面我们将详细介绍这个整合过程: 1. **Flex与Spring的整合**: - 使用Spring BlazeDS Integration项目,它提供了...
Flex+Spring+Hibernate是开发企业级Web应用的一种经典组合,它们各自在软件开发的不同层面上发挥着关键作用。本文将深入解析这三个技术及其在实际项目中的整合应用。 Flex是Adobe公司推出的基于ActionScript和MXML...
标题和描述中提到的"flex+spring+hibernate+mysql"是一个常见的技术栈,用于构建企业级的Web应用程序。这个组合涵盖了前端展示层、后端业务逻辑层、持久化层以及数据库存储层的关键组件。 1. **Flex**: Flex是Adobe...
Flex+BlazeDS+Spring+Hibernate 是一个经典的前端与后端集成方案,广泛应用于构建富互联网应用程序(Rich Internet Applications,RIA)。在这个框架组合中,Flex 作为用户界面层,提供了丰富的交互体验;BlazeDS ...
flex+bleazeds+spring+hibernate配置的教程,有详尽过程,是flex与spring结合的不错的教程
本文将介绍如何搭建一个基于Flex、Spring和Hibernate的开发环境,以及使用BlazeDS作为数据通信中间件。这些技术都是构建现代企业级Web应用的重要组件。 1. **Flex**: Flex 是Adobe开发的一套用于创建富互联网应用...
Flex、Spring和Hibernate是三个在IT领域中广泛使用的开源框架,它们分别专注于用户界面、服务层管理和持久化数据。这个“Flex+spring+hibernate”视频教程可能涵盖了如何将这三个技术有效地集成在一起,以便构建...
通过上述步骤,我们可以成功地整合 Flex、BlazeDS、Spring 和 Hibernate 来开发一个完整的 Web 应用程序。这种整合不仅可以提高开发效率,还能充分利用各种技术的优势,从而构建出功能强大且易于维护的应用系统。在...
《Flex+Java+Spring+Hibernate+BlazeDS整合详解》 在现代的Web开发中,Flex作为客户端的富互联网应用程序(RIA)框架,与Java、Spring、Hibernate等后端技术结合,可以构建出高效、交互性强的Web应用。本文将详细...
【配置flex+bleazeds+spring+hibernate】是一个集成开发环境的构建过程,用于创建基于Adobe Flex前端,BlazeDS作为数据通信中间层,Spring作为应用框架,以及Hibernate作为持久层技术的Java Web应用程序。...
标题中的“PureMVC+Flex+BlazeDS+Spring+Hibernate”是一个常见的技术栈组合,用于构建企业级的 Rich Internet Applications (RIA)。这个技术栈包括前端开发框架、后端服务通讯、应用服务器、服务端架构和数据持久化...