- 浏览: 110944 次
- 性别:
- 来自: 武汉
文章分类
最新评论
-
renlifeng:
有没有完整的代码下载?我按照你说的做了。结果是滑动的时候是不正 ...
IPhone 之 UIPageControl,UIScrollView 分页 -
fireflylover:
MyEclipse你安装完成后就会有一个Eclipse文件夹呀 ...
Flex+J2EE+Lcds在myEclipse中的安装 -
flyheart_1989:
您好,我想请问你个问题:
(6)注意:这一步很重要,是要你选择 ...
Flex+J2EE+Lcds在myEclipse中的安装 -
baixiaozhe:
不错 很有用
Flex 读取XML配置文件总结 -
harry_2013:
楼主辛苦了, 小弟刚接触abap。郁闷ing
SAP标准教材名称所代表的模块和含义(转)
在 myeclipse 中配置Flex + Spring + Hiberate + Struts
1. web.xml 的配置
<web-app>
<display-name>FLEX_J2EEDEMO</display-name>
<description>
Administration tools for monitoring and management
</description>
<context-param>
<param-name>flex.class.path</param-name>
<param-value>
/WEB-INF/flex/hotfixes,/WEB-INF/flex/jars
</param-value>
</context-param>
<!-- 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>
<servlet-name>action</servlet-name>
<servlet-class>
org.apache.struts.action.ActionServlet
</servlet-class>
<init-param>
<param-name>config</param-name>
<param-value>/WEB-INF/struts-config.xml</param-value>
</init-param>
<init-param>
<param-name>debug</param-name>
<param-value>3</param-value>
</init-param>
<init-param>
<param-name>detail</param-name>
<param-value>3</param-value>
</init-param>
<load-on-startup>0</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>MessageBrokerServlet</servlet-name>
<url-pattern>/messagebroker/*</url-pattern>
</servlet-mapping>
<!-- 添加spring -->
<servlet>
<servlet-name>SpringContextServlet</servlet-name>
<servlet-class>
org.springframework.web.context.ContextLoaderServlet
</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>action</servlet-name>
<url-pattern>*.do</url-pattern>
</servlet-mapping>
<welcome-file-list>
<welcome-file>index.html</welcome-file>
</welcome-file-list>
<!-- for WebSphere deployment, please uncomment -->
<!--
<resource-ref>
<description>Flex Messaging WorkManager</description>
<res-ref-name>wm/MessagingWorkManager</res-ref-name>
<res-type>com.ibm.websphere.asynchbeans.WorkManager</res-type>
<res-auth>Container</res-auth>
<res-sharing-scope>Shareable</res-sharing-scope>
</resource-ref>
-->
</web-app>
2. Spring , Hiberate , Struts 的配置参加一般J2EE 配置
3. 配置flex
项目WEB-INF下建立flex文件夹,放置services-config.xml,remoting-config.xml。
services-config.xml 内容如下:
<?xml version="1.0" encoding="UTF-8"?>
<services-config>
<services>
<service-include file-path="remoting-config.xml" />
</services>
<factories>
<factory id="spring" class="flex.samples.factories.SpringFactory"/>
</factories>
<security>
<login-command class="flex.messaging.security.TomcatLoginCommand" server="Tomcat"/>
<!-- Uncomment the correct app server
<login-command class="flex.messaging.security.TomcatLoginCommand" server="JBoss">
<login-command class="flex.messaging.security.JRunLoginCommand" server="JRun"/>
<login-command class="flex.messaging.security.WeblogicLoginCommand" server="Weblogic"/>
<login-command class="flex.messaging.security.WebSphereLoginCommand" server="WebSphere"/>
-->
<!--
If running the console on WebSphere with administrative security enabled uncomment this section. Also,
create a User Group called "console_administrator" and add any users that are allowed to use the console to this group.
These users must also have at least one role that allows them to access MBeans under WebSphere security. Finally,
be sure to use the WebSphere login-command above.
<security-constraint id="console">
<auth-method>Basic</auth-method>
<roles>
<role>console_administrator</role>
</roles>
</security-constraint>
-->
</security>
<channels>
<channel-definition id="amf" class="mx.messaging.channels.AMFChannel">
<endpoint url="http://{server.name}:{server.port}/{context.root}/messagebroker/amf" class="flex.messaging.endpoints.AMFEndpoint"/>
<properties>
<polling-enabled>false</polling-enabled>
</properties>
</channel-definition>
</channels>
<logging>
<!-- You may also use flex.messaging.log.ServletLogTarget -->
<target class="flex.messaging.log.ConsoleTarget" level="Error">
<properties>
<prefix>[BlazeDS] </prefix>
<includeDate>false</includeDate>
<includeTime>false</includeTime>
<includeLevel>true</includeLevel>
<includeCategory>true</includeCategory>
</properties>
<filters>
<pattern>Endpoint.*</pattern>
</filters>
</target>
</logging>
<system>
<redeploy>
<enabled>true</enabled>
<watch-interval>20</watch-interval>
<watch-file>{context.root}/WEB-INF/flex/services-config.xml</watch-file>
<touch-file>{context.root}/WEB-INF/web.xml</touch-file>
</redeploy>
</system>
</services-config>
remoting-config.xml内容如下
<?xml version="1.0" encoding="UTF-8"?>
<service id="remoting-service"
class="flex.messaging.services.RemotingService"
messageTypes="flex.messaging.messages.RemotingMessage">
<adapters>
<adapter-definition id="java-object" class="flex.messaging.services.remoting.adapters.JavaAdapter" default="true"/>
</adapters>
<default-channels>
<channel ref="amf"/>
</default-channels>
<!-- 定义名为userService的服务 ,从spring容器中获得-->
<destination id="userService">
<properties>
<factory>spring</factory>
<source>userService</source>
</properties>
</destination>
</service>
通过以上配置文件,可在.mxml中直接应用J2ee 中的 userService
如FLEX_LOGIN.mxml中登录应用,内容如下
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" xmlns:rpc="com.adobe.fxstruts.rpc.*" layout="absolute" >
<mx:Script>
<![CDATA[
import flash.events.Event;
import mx.controls.Alert;
import mx.utils.ArrayUtil;
import mx.rpc.events.ResultEvent;
import mx.controls.Alert;
private var userObj:Object=new Object();
public var userName:String="";
private function reset():void{
username.text="";
password.text="";
}
private function sendKeyHandler(evt:KeyboardEvent):void
{
//Enter 键
if (evt.keyCode == 13)
{
this.login();
return ;
}
}
private function loginResult(result:Object):void
{
userObj=Object(result);
if(userObj["userPwd"]==password.text){
Alert.show(userObj["fullName"]+"登录成功!");
}else
{
Alert.show(username.text+"登录失败!");
}
}
private function login():void{
if(username.text=="" || password.text=="" ){
Alert.show("请输入用户名或密码!");
}else{
userObj = getData.getUserByCode(username.text);
userName=username.text;
}
}
]]>
</mx:Script>
<mx:Panel
height="75%" width="75%" layout="absolute"
paddingTop="10" paddingBottom="10" paddingLeft="10" paddingRight="10">
<mx:Label width="71" color="blue" text="用户名" fontSize="14" x="41" y="36"/>
<mx:TextInput width="148" height="20" id="username" maxChars="20" editable="true" cornerRadius="1" x="97" y="38"/>
<mx:Label width="37" color="blue" text="密码" fontSize="14" x="41" y="76"/>
<mx:TextInput editable="true" width="148" height="20" id="password" cornerRadius="1" displayAsPassword="true" enabled="true" maxChars="20" x="97" y="78" keyDown="sendKeyHandler(event)"/>
<mx:Button label="登录" width="67" fontSize="12" x="58" y="118" click="login()"/>
<mx:Button label="取消" width="68" fontSize="12" x="154" y="118" click="reset()"/>
</mx:Panel>
<mx:RemoteObject id="getData" destination="userService">
<mx:method name="getUserByCode" result="loginResult(event.result)" fault="Alert.show(event.fault.faultString,'Error')"/>
</mx:RemoteObject>
</mx:Application>
1. web.xml 的配置
<web-app>
<display-name>FLEX_J2EEDEMO</display-name>
<description>
Administration tools for monitoring and management
</description>
<context-param>
<param-name>flex.class.path</param-name>
<param-value>
/WEB-INF/flex/hotfixes,/WEB-INF/flex/jars
</param-value>
</context-param>
<!-- 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>
<servlet-name>action</servlet-name>
<servlet-class>
org.apache.struts.action.ActionServlet
</servlet-class>
<init-param>
<param-name>config</param-name>
<param-value>/WEB-INF/struts-config.xml</param-value>
</init-param>
<init-param>
<param-name>debug</param-name>
<param-value>3</param-value>
</init-param>
<init-param>
<param-name>detail</param-name>
<param-value>3</param-value>
</init-param>
<load-on-startup>0</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>MessageBrokerServlet</servlet-name>
<url-pattern>/messagebroker/*</url-pattern>
</servlet-mapping>
<!-- 添加spring -->
<servlet>
<servlet-name>SpringContextServlet</servlet-name>
<servlet-class>
org.springframework.web.context.ContextLoaderServlet
</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>action</servlet-name>
<url-pattern>*.do</url-pattern>
</servlet-mapping>
<welcome-file-list>
<welcome-file>index.html</welcome-file>
</welcome-file-list>
<!-- for WebSphere deployment, please uncomment -->
<!--
<resource-ref>
<description>Flex Messaging WorkManager</description>
<res-ref-name>wm/MessagingWorkManager</res-ref-name>
<res-type>com.ibm.websphere.asynchbeans.WorkManager</res-type>
<res-auth>Container</res-auth>
<res-sharing-scope>Shareable</res-sharing-scope>
</resource-ref>
-->
</web-app>
2. Spring , Hiberate , Struts 的配置参加一般J2EE 配置
3. 配置flex
项目WEB-INF下建立flex文件夹,放置services-config.xml,remoting-config.xml。
services-config.xml 内容如下:
<?xml version="1.0" encoding="UTF-8"?>
<services-config>
<services>
<service-include file-path="remoting-config.xml" />
</services>
<factories>
<factory id="spring" class="flex.samples.factories.SpringFactory"/>
</factories>
<security>
<login-command class="flex.messaging.security.TomcatLoginCommand" server="Tomcat"/>
<!-- Uncomment the correct app server
<login-command class="flex.messaging.security.TomcatLoginCommand" server="JBoss">
<login-command class="flex.messaging.security.JRunLoginCommand" server="JRun"/>
<login-command class="flex.messaging.security.WeblogicLoginCommand" server="Weblogic"/>
<login-command class="flex.messaging.security.WebSphereLoginCommand" server="WebSphere"/>
-->
<!--
If running the console on WebSphere with administrative security enabled uncomment this section. Also,
create a User Group called "console_administrator" and add any users that are allowed to use the console to this group.
These users must also have at least one role that allows them to access MBeans under WebSphere security. Finally,
be sure to use the WebSphere login-command above.
<security-constraint id="console">
<auth-method>Basic</auth-method>
<roles>
<role>console_administrator</role>
</roles>
</security-constraint>
-->
</security>
<channels>
<channel-definition id="amf" class="mx.messaging.channels.AMFChannel">
<endpoint url="http://{server.name}:{server.port}/{context.root}/messagebroker/amf" class="flex.messaging.endpoints.AMFEndpoint"/>
<properties>
<polling-enabled>false</polling-enabled>
</properties>
</channel-definition>
</channels>
<logging>
<!-- You may also use flex.messaging.log.ServletLogTarget -->
<target class="flex.messaging.log.ConsoleTarget" level="Error">
<properties>
<prefix>[BlazeDS] </prefix>
<includeDate>false</includeDate>
<includeTime>false</includeTime>
<includeLevel>true</includeLevel>
<includeCategory>true</includeCategory>
</properties>
<filters>
<pattern>Endpoint.*</pattern>
</filters>
</target>
</logging>
<system>
<redeploy>
<enabled>true</enabled>
<watch-interval>20</watch-interval>
<watch-file>{context.root}/WEB-INF/flex/services-config.xml</watch-file>
<touch-file>{context.root}/WEB-INF/web.xml</touch-file>
</redeploy>
</system>
</services-config>
remoting-config.xml内容如下
<?xml version="1.0" encoding="UTF-8"?>
<service id="remoting-service"
class="flex.messaging.services.RemotingService"
messageTypes="flex.messaging.messages.RemotingMessage">
<adapters>
<adapter-definition id="java-object" class="flex.messaging.services.remoting.adapters.JavaAdapter" default="true"/>
</adapters>
<default-channels>
<channel ref="amf"/>
</default-channels>
<!-- 定义名为userService的服务 ,从spring容器中获得-->
<destination id="userService">
<properties>
<factory>spring</factory>
<source>userService</source>
</properties>
</destination>
</service>
通过以上配置文件,可在.mxml中直接应用J2ee 中的 userService
如FLEX_LOGIN.mxml中登录应用,内容如下
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" xmlns:rpc="com.adobe.fxstruts.rpc.*" layout="absolute" >
<mx:Script>
<![CDATA[
import flash.events.Event;
import mx.controls.Alert;
import mx.utils.ArrayUtil;
import mx.rpc.events.ResultEvent;
import mx.controls.Alert;
private var userObj:Object=new Object();
public var userName:String="";
private function reset():void{
username.text="";
password.text="";
}
private function sendKeyHandler(evt:KeyboardEvent):void
{
//Enter 键
if (evt.keyCode == 13)
{
this.login();
return ;
}
}
private function loginResult(result:Object):void
{
userObj=Object(result);
if(userObj["userPwd"]==password.text){
Alert.show(userObj["fullName"]+"登录成功!");
}else
{
Alert.show(username.text+"登录失败!");
}
}
private function login():void{
if(username.text=="" || password.text=="" ){
Alert.show("请输入用户名或密码!");
}else{
userObj = getData.getUserByCode(username.text);
userName=username.text;
}
}
]]>
</mx:Script>
<mx:Panel
height="75%" width="75%" layout="absolute"
paddingTop="10" paddingBottom="10" paddingLeft="10" paddingRight="10">
<mx:Label width="71" color="blue" text="用户名" fontSize="14" x="41" y="36"/>
<mx:TextInput width="148" height="20" id="username" maxChars="20" editable="true" cornerRadius="1" x="97" y="38"/>
<mx:Label width="37" color="blue" text="密码" fontSize="14" x="41" y="76"/>
<mx:TextInput editable="true" width="148" height="20" id="password" cornerRadius="1" displayAsPassword="true" enabled="true" maxChars="20" x="97" y="78" keyDown="sendKeyHandler(event)"/>
<mx:Button label="登录" width="67" fontSize="12" x="58" y="118" click="login()"/>
<mx:Button label="取消" width="68" fontSize="12" x="154" y="118" click="reset()"/>
</mx:Panel>
<mx:RemoteObject id="getData" destination="userService">
<mx:method name="getUserByCode" result="loginResult(event.result)" fault="Alert.show(event.fault.faultString,'Error')"/>
</mx:RemoteObject>
</mx:Application>
发表评论
-
flex xml转ArrayCollection
2011-10-17 15:51 11881.xml文件数据样式: <MyDataList> ... -
flex TabNavigator的标签页默认是点击后才初始化
2011-09-01 17:20 1021TabNavigator的标签页默认是点击后才初始化。所以,如 ... -
flex 表单验证大全
2011-08-26 16:52 8371.验证必填项代 码如下:<mx:Validator i ... -
FLex3中弹出窗口包含TabNavigator时标签页的标题显示不完全的问题及解决方法
2011-04-07 14:53 2348解决方法有3种: 1.增加样式activeTabStyle并 ... -
Flex操作颜色值及图像颜色变换
2011-02-17 11:21 1077根据色彩值分离出单 ... -
Flex session相关操作
2011-02-15 16:53 9221.写 session mxml 文件 加 <mx: ... -
flex 和javascript互相调用
2011-02-15 16:50 915一、flex 调用javascript 只需使用静态的Ext ... -
通过页面传递参数到flex中的几种方法
2010-07-14 15:27 10141.在和中设置flashVars参数,例如: < ... -
解决Flex从页面 URL里获取参数的问题
2010-07-14 15:19 12161:当用http://xxxxx/xxx.mxml?name= ... -
flex builder 4 注册码可用破解
2010-07-08 10:03 4522破解flex builder 4的方法只需两步: 1. 注册 ... -
ISO Latin-1字符集(HTML实体对照)-在Flex Tooltip中换行
2010-07-06 17:17 1236Flex帮助告诉我们,要在MXML的属性中使用特殊字符,可以使 ... -
Flex中UI组件拖拽的三种实现
2009-11-12 16:04 1097一、最简单的是直接调用ui组件的startDrag方法和sto ... -
flex 网站大全
2009-11-09 15:40 1745一、国外站点 1.资源网站 Adobe Labs : ... -
Flex 读取XML配置文件总结
2009-11-09 15:36 2756在Flex中我们经常使用x ... -
Flex事件讲解(三)
2009-11-09 15:26 829三.绑定机制在我们了解了事件机制后,那么理解绑定就不难了。绑定 ... -
Flex事件讲解(二)
2009-11-09 15:24 9612. 事件注册通道上面说 ... -
Flex事件讲解(一)
2009-11-09 15:11 822关于flex事件的讲解 一.引很多新人对Fle ... -
JAVA对象与AS间的转化关系对照表
2009-09-10 11:39 8261. 先是JAVA2AS 2. 下面是AS2JAVA的 ... -
Flex+J2EE+Lcds在myEclipse中的安装
2009-08-19 14:42 2616MyEclipse中安装FLEX插件 2009-05-22 ... -
Flex组件——Alert应用
2009-08-19 10:56 1240Alert组件使用方法,通过Alert.show(...... ...
相关推荐
本方案提供了一种集成化的开发环境,即"MyEclipse7.5+flex4+spring3.0.5+struts2.2.1+hibernate3.6.0+blazeds4.0.0.14931完美整合方案",它将多个流行的技术框架整合在一起,为Web应用程序开发提供了一个强大的平台...
本文将详细介绍如何在MyEclipse7.5环境下整合Flex4、Spring、Struts、Hibernate以及Blazeds,构建一个强大的企业级Web应用。这个整合涉及到的技术栈广泛,旨在提供一个灵活且功能丰富的前后端交互解决方案。 1. **...
如果你的项目中还需要使用SSH(Spring、Struts和Hibernate)框架,那么在`WebContent/WEB-INF`目录下添加对应的配置文件(如`struts-config.xml`, `spring-servlet.xml`等),并把SSH所需的JAR库添加到`WebContent/...
7. **整合SSH框架**:如果项目需要使用Spring、Struts和Hibernate等SSH框架,你只需在`WebContent/WEB-INF`下添加相应的配置文件(如`struts-config.xml`, `spring-servlet.xml`等)以及对应的JAR库文件。...
4. **SSH(Spring、Struts、Hibernate)**:SSH 是一套流行的企业级 Java 开发框架组合,Spring 提供了依赖注入和面向切面编程,Struts 是一个 MVC 框架,用于处理 HTTP 请求,Hibernate 是一个对象关系映射(ORM)...
如果需要在项目中使用SSH,只需在WebContent/WEB-INF下添加相应的配置文件(如struts-config.xml、spring-servlet.xml等),并将所需的jar包添加到lib目录。 以上步骤完成后,你便成功地在MyEclipse中搭建了一个...
- **MyEclipse 8.6**:MyEclipse是一款针对Java EE的集成开发环境,它是Eclipse的扩展,支持包括Java、JSP、JavaScript、SQL、Struts、Spring、Hibernate等多种技术。 - **BlazeDS**:BlazeDS是Adobe提供的一个...
本文档主要介绍了如何在Myeclipse8.5环境下搭建Flex4.5、Blazeds和SSH(Spring、Struts、Hibernate)的开发环境。以下是详细步骤及涉及的相关知识点: 1. **Flex和Blazeds简介** - **Flex**:是一种基于...
3. **MyEclipse**:MyEclipse是一款强大的Java集成开发环境,是Eclipse的商业版本,提供了一系列的工具,如代码编辑、调试、发布等,特别适合Java、JSP、Servlet、Struts、Spring、Hibernate等Web应用的开发。...
本文将详细介绍如何在MyEclipse 8.0中配置Flex 4插件以及BlazeDS,以便于进行高效的Flex应用开发。 一、MyEclipse 8.0与Flex 4的结合 MyEclipse 8.0是基于Eclipse平台的扩展,它集成了众多的Java、Web和企业级开发...
本资源包含的"flexweb"可能是一个示例项目或者开发框架,它展示了如何在MyEclipse 8.5中配置和使用Flex 4进行开发。通过研究源码,开发者可以了解如何搭建Java-Flex应用,理解AMF通信机制,以及掌握Spark组件的使用...
而S2SH是Struts2、Spring和Hibernate的组合,是Java Web开发中常见的MVC框架。整合Flex与S2SH可以让前端的富用户体验与后端的强大业务处理能力相结合,实现高效且功能丰富的Web应用。 一、开发环境准备 1. 开发...
Flex3+SSH框架是一种用于构建富互联网应用程序(RIA)的技术组合,它结合了Adobe Flex 3作为前端开发工具,以及Spring、Struts和Hibernate这三种Java后端框架。这种组合允许开发者创建高度交互且功能丰富的Web应用,...
在MyEclipse中,你可以创建一个Web服务,然后在FlexBuilder中配置对应的AMF通道,这样Flex就可以通过AMF调用Java方法了。HTTP服务则适用于不涉及二进制数据传输的情况,例如发送XML或JSON数据。 在实际开发过程中,...
MyEclipse是Eclipse的一个扩展,提供了更多的企业级开发特性,如对Spring、Hibernate、Struts等框架的支持,以及数据库管理和Web服务工具。7.5版本可能包含了一些性能优化和新的功能更新,使得开发过程更为高效。 ...
它基于Eclipse平台,提供了对Java、JSP、Servlet、Struts、Spring、Hibernate等多种技术的支持。在CRM系统开发中,MyEclipse可以帮助开发者编写、调试、测试和部署应用程序,提供了一站式的开发解决方案。 Flex3是...
7. **整合过程**:集成Flex和SSH涉及到几个关键步骤,包括设置Flex Builder或MyEclipse的Blazeds配置,编写ActionScript代码与后端服务交互,配置Struts2的Action和Result,以及在Spring中定义Bean和数据源。...
同时,在`Flex WAR File`中配置负责远程方法调用的`blazeds.war`文件。 3. **配置输出目录**:确保`Output folder`配置到WebRoot目录内,便于启动服务器后直接运行Flex Application。 4. **集成J2EE功能**:对于...
6. **MyEclipse**: MyEclipse 是一个基于Eclipse的集成开发环境,专门用于Java和Web开发,包括对J2EE、Spring、Struts和Hibernate等框架的支持。在搭建环境中,MyEclipse 6.5.0 用于创建Web项目和管理服务器。 7. *...