- 浏览: 520735 次
- 性别:
- 来自: 深圳
文章分类
- 全部博客 (299)
- Oracle(pl/sql_Erp_Pro*C) (69)
- 设计模式 (4)
- spring (23)
- ext (17)
- apache开源项目应用 (4)
- jquery (16)
- 生活琐事 (8)
- 下载资源 (23)
- mysql (2)
- Eclipse使用积累 (5)
- 报表类(报表/图表) (13)
- php (4)
- Web多彩文本框 (3)
- json (4)
- jqgrid (2)
- ant (2)
- java算法积累 (8)
- EL表达式/JSTL (4)
- poi (3)
- gwt (2)
- 爬网第一步 (2)
- javascript (17)
- Javaweb (8)
- tomcat (1)
- flex (1)
- Java&DB (3)
- J2SE (7)
- linux (3)
- 数据结构 (1)
- dot net (5)
- struts (1)
- ibatis (1)
- log4j (1)
- 项目管理 (1)
- Java native interface(jni,jacob......) (5)
- applet (1)
- VB.net/C#.net/JNI (20)
- css (1)
- Sqlite (1)
- servlet (1)
- REST (1)
最新评论
-
wenhurena:
能不能给一下解压密码roki.work.2017@gmail. ...
Ebs解体新書と学習資料1 -
liutao1600:
楼主写的太好了,每天学习~~
Spring_MVC(6)测试 -
liutao1600:
太好了,每天学习你的文章~~~
Spring_MVC(3)表单页面处理 -
liutao1600:
学习了,太好了
Spring_MVC(2)控制层处理 -
liutao1600:
学习了~~~
Spring_MVC(1)构建简单web应用
flex拓扑图制作只是一个简单的例子,可以运行,只是简单的呈现部分,如果要实现具体的拓扑图的功能,需要连接数据库,这里只简单说说flex与spring的结合,有了spring,再与hibernate以及struts就简单多了。
1、首先是web.xml需要添加flex的配置,增加如下的内容:
- <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>
- <init-param>
- <param-name>flex.write.path</param-name>
- <param-value>/WEB-INF/flex</param-value>
- </init-param>
- <load-on-startup>1</load-on-startup>
- </servlet>
- <servlet>
- <servlet-name>FlexMxmlServlet</servlet-name>
- <display-name>MXML Processor</display-name>
- <description>Servlet wrapper for the Mxml Compiler</description>
- <servlet-class>flex.bootstrap.BootstrapServlet</servlet-class>
- <init-param>
- <param-name>servlet.class</param-name>
- <param-value>flex.webtier.server.j2ee.MxmlServlet</param-value>
- </init-param>
- <init-param>
- <param-name>webtier.configuration.file</param-name>
- <param-value>/WEB-INF/flex/flex-webtier-config.xml</param-value>
- </init-param>
- <load-on-startup>1</load-on-startup>
- </servlet>
- <servlet>
- <servlet-name>FlexSwfServlet</servlet-name>
- <display-name>SWF Retriever</display-name>
- <servlet-class>flex.bootstrap.BootstrapServlet</servlet-class>
- <init-param>
- <param-name>servlet.class</param-name>
- <param-value>flex.webtier.server.j2ee.SwfServlet</param-value>
- </init-param>
- <!-- SwfServlet must be initialized after MxmlServlet -->
- <load-on-startup>2</load-on-startup>
- </servlet>
- <servlet>
- <servlet-name>FlexForbiddenServlet</servlet-name>
- <display-name>Prevents access to *.as/*.swc files</display-name>
- <servlet-class>flex.bootstrap.BootstrapServlet</servlet-class>
- <init-param>
- <param-name>servlet.class</param-name>
- <param-value>flex.webtier.server.j2ee.ForbiddenServlet</param-value>
- </init-param>
- </servlet>
- <servlet>
- <servlet-name>FlexInternalServlet</servlet-name>
- <servlet-class>flex.bootstrap.BootstrapServlet</servlet-class>
- <init-param>
- <param-name>servlet.class</param-name>
- <param-value>flex.webtier.server.j2ee.filemanager.FileManagerServlet</param-value>
- </init-param>
- <load-on-startup>10</load-on-startup>
- </servlet>
- <servlet-mapping>
- <servlet-name>MessageBrokerServlet</servlet-name>
- <url-pattern>/messagebroker/*</url-pattern>
- </servlet-mapping>
- <servlet-mapping>
- <servlet-name>FlexMxmlServlet</servlet-name>
- <url-pattern>*.mxml</url-pattern>
- </servlet-mapping>
- <servlet-mapping>
- <servlet-name>FlexSwfServlet</servlet-name>
- <url-pattern>*.swf</url-pattern>
- </servlet-mapping>
- <servlet-mapping>
- <servlet-name>FlexForbiddenServlet</servlet-name>
- <url-pattern>*.as</url-pattern>
- </servlet-mapping>
- <servlet-mapping>
- <servlet-name>FlexForbiddenServlet</servlet-name>
- <url-pattern>*.swc</url-pattern>
- </servlet-mapping>
- <servlet-mapping>
- <servlet-name>FlexInternalServlet</servlet-name>
- <url-pattern>/flex-internal/*</url-pattern>
- </servlet-mapping>
<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> <init-param> <param-name>flex.write.path</param-name> <param-value>/WEB-INF/flex</param-value> </init-param> <load-on-startup>1</load-on-startup> </servlet> <servlet> <servlet-name>FlexMxmlServlet</servlet-name> <display-name>MXML Processor</display-name> <description>Servlet wrapper for the Mxml Compiler</description> <servlet-class>flex.bootstrap.BootstrapServlet</servlet-class> <init-param> <param-name>servlet.class</param-name> <param-value>flex.webtier.server.j2ee.MxmlServlet</param-value> </init-param> <init-param> <param-name>webtier.configuration.file</param-name> <param-value>/WEB-INF/flex/flex-webtier-config.xml</param-value> </init-param> <load-on-startup>1</load-on-startup> </servlet> <servlet> <servlet-name>FlexSwfServlet</servlet-name> <display-name>SWF Retriever</display-name> <servlet-class>flex.bootstrap.BootstrapServlet</servlet-class> <init-param> <param-name>servlet.class</param-name> <param-value>flex.webtier.server.j2ee.SwfServlet</param-value> </init-param> <!-- SwfServlet must be initialized after MxmlServlet --> <load-on-startup>2</load-on-startup> </servlet> <servlet> <servlet-name>FlexForbiddenServlet</servlet-name> <display-name>Prevents access to *.as/*.swc files</display-name> <servlet-class>flex.bootstrap.BootstrapServlet</servlet-class> <init-param> <param-name>servlet.class</param-name> <param-value>flex.webtier.server.j2ee.ForbiddenServlet</param-value> </init-param> </servlet> <servlet> <servlet-name>FlexInternalServlet</servlet-name> <servlet-class>flex.bootstrap.BootstrapServlet</servlet-class> <init-param> <param-name>servlet.class</param-name> <param-value>flex.webtier.server.j2ee.filemanager.FileManagerServlet</param-value> </init-param> <load-on-startup>10</load-on-startup> </servlet> <servlet-mapping> <servlet-name>MessageBrokerServlet</servlet-name> <url-pattern>/messagebroker/*</url-pattern> </servlet-mapping> <servlet-mapping> <servlet-name>FlexMxmlServlet</servlet-name> <url-pattern>*.mxml</url-pattern> </servlet-mapping> <servlet-mapping> <servlet-name>FlexSwfServlet</servlet-name> <url-pattern>*.swf</url-pattern> </servlet-mapping> <servlet-mapping> <servlet-name>FlexForbiddenServlet</servlet-name> <url-pattern>*.as</url-pattern> </servlet-mapping> <servlet-mapping> <servlet-name>FlexForbiddenServlet</servlet-name> <url-pattern>*.swc</url-pattern> </servlet-mapping> <servlet-mapping> <servlet-name>FlexInternalServlet</servlet-name> <url-pattern>/flex-internal/*</url-pattern> </servlet-mapping>
2、在spring的配置文件中增加:
- <bean id="topoMapViewService" parent="baseTransaction">
- <property name="target">
- <bean
- class="com.jeffrey.nms.service.impl.TopoServiceImpl"><!---这里的方法可以通过flex进行调用--->
- <property name="topoMapDao" ref="topoMapDao" />
- <property name="linkInfoDao" ref="linkInfoDao" />
- </bean>
- </property>
- </bean>
<bean id="topoMapViewService" parent="baseTransaction">
<property name="target">
<bean
class="com.jeffrey.nms.service.impl.TopoServiceImpl"><!---这里的方法可以通过flex进行调用--->
<property name="topoMapDao" ref="topoMapDao" />
<property name="linkInfoDao" ref="linkInfoDao" />
</bean>
</property>
</bean>
3、然后需要配置flex的配置文件,flex文件下有个services-config.xml,
增加:
- <factories>
- <factory id="spring" class="com.jeffrey.nms.web.topo.SpringFactory"/>
- </factories>
<factories> <factory id="spring" class="com.jeffrey.nms.web.topo.SpringFactory"/> </factories>
其中类如下(通过网上查的)
- package com.jeffrey.nms.web.topo;
- import org.springframework.context.ApplicationContext;
- import org.springframework.web.context.support.WebApplicationContextUtils;
- import org.springframework.beans.BeansException;
- import org.springframework.beans.factory.NoSuchBeanDefinitionException;
- import flex.messaging.FactoryInstance;
- import flex.messaging.FlexFactory;
- import flex.messaging.config.ConfigMap;
- import flex.messaging.services.ServiceException;
- public class SpringFactory implements FlexFactory
- {
- private static final String SOURCE = "source";
- public void initialize(String id, ConfigMap configMap) {}
- public FactoryInstance createFactoryInstance(String id, ConfigMap properties)
- {
- SpringFactoryInstance instance = new SpringFactoryInstance(this, id, properties);
- instance.setSource(properties.getPropertyAsString(SOURCE, instance.getId()));
- return instance;
- } // end method createFactoryInstance()
- public Object lookup(FactoryInstance inst)
- {
- SpringFactoryInstance factoryInstance = (SpringFactoryInstance) inst;
- return factoryInstance.lookup();
- }
- static class SpringFactoryInstance extends FactoryInstance
- {
- SpringFactoryInstance(SpringFactory factory, String id, ConfigMap properties)
- {
- super(factory, id, properties);
- }
- public String toString()
- {
- return "SpringFactory instance for id=" + getId() + " source=" + getSource() + " scope=" + getScope();
- }
- 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();
- String msg = "Spring service named '" + beanName + "' does not exist.";
- e.setMessage(msg);
- e.setRootCause(nexc);
- e.setDetails(msg);
- e.setCode("Server.Processing");
- throw e;
- }
- catch (BeansException bexc)
- {
- ServiceException e = new ServiceException();
- String msg = "Unable to create Spring service named '" + beanName + "' ";
- e.setMessage(msg);
- e.setRootCause(bexc);
- e.setDetails(msg);
- e.setCode("Server.Processing");
- throw e;
- }
- }
- }
- }
package com.jeffrey.nms.web.topo; import org.springframework.context.ApplicationContext; import org.springframework.web.context.support.WebApplicationContextUtils; import org.springframework.beans.BeansException; import org.springframework.beans.factory.NoSuchBeanDefinitionException; import flex.messaging.FactoryInstance; import flex.messaging.FlexFactory; import flex.messaging.config.ConfigMap; import flex.messaging.services.ServiceException; public class SpringFactory implements FlexFactory { private static final String SOURCE = "source"; public void initialize(String id, ConfigMap configMap) {} public FactoryInstance createFactoryInstance(String id, ConfigMap properties) { SpringFactoryInstance instance = new SpringFactoryInstance(this, id, properties); instance.setSource(properties.getPropertyAsString(SOURCE, instance.getId())); return instance; } // end method createFactoryInstance() public Object lookup(FactoryInstance inst) { SpringFactoryInstance factoryInstance = (SpringFactoryInstance) inst; return factoryInstance.lookup(); } static class SpringFactoryInstance extends FactoryInstance { SpringFactoryInstance(SpringFactory factory, String id, ConfigMap properties) { super(factory, id, properties); } public String toString() { return "SpringFactory instance for id=" + getId() + " source=" + getSource() + " scope=" + getScope(); } 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(); String msg = "Spring service named '" + beanName + "' does not exist."; e.setMessage(msg); e.setRootCause(nexc); e.setDetails(msg); e.setCode("Server.Processing"); throw e; } catch (BeansException bexc) { ServiceException e = new ServiceException(); String msg = "Unable to create Spring service named '" + beanName + "' "; e.setMessage(msg); e.setRootCause(bexc); e.setDetails(msg); e.setCode("Server.Processing"); throw e; } } } }
4、本人做flex时是使用的直接调用java的运程类,以下都是按照这个配置的,还有一个webservice的方法,各位可以收集收集。
在flex文件夹下有个remoting-config.xml文件,需要增加:
- <destination id="topoMap">
- <properties>
- <factory>spring</factory>
- <source>topoMapViewService</source>
- </properties>
- lt;/destination>
<destination id="topoMap"> <properties> <factory>spring</factory> <source>topoMapViewService</source> </properties> </destination>
这样topoMap可以在flex进行定义了,如下:
<mx:RemoteObject id="topo" destination="topoMap">
这样flex+spring配置即完成。
相关推荐
Flex+Spring+Hibernate 整合是企业级应用开发中常见的一种技术栈组合,它结合了Flex前端的富互联网应用程序(RIA)开发能力、Spring框架的依赖注入和事务管理功能,以及Hibernate持久化框架的数据库操作便捷性。...
Flex+Spring+Hibernate示例是一种常见的企业级应用架构,它结合了Adobe Flex前端技术、Spring后端框架和Hibernate持久层框架,以构建高效、灵活且易于维护的Web应用程序。在这个示例中,开发者可能已经展示了如何...
在Spring配置文件中引入Mapper扫描器,使Spring能够自动发现并管理Mapper。 5. **创建HTTP服务**:在Spring MVC中创建Controller,定义处理HTTP请求的方法,这些方法将调用Service层的业务逻辑。 6. **Flex与...
3. **定义Spring服务**:在Spring配置文件中定义需要暴露给Flex的Bean,这些Bean通常是业务服务或DAO。例如,可以有一个名为`UserService`的Bean,提供用户管理功能。 4. **配置BlazeDS服务代理**:在Flex项目中,...
标题中的“PureMVC+Flex+BlazeDS+Spring+Hibernate.doc”指的是一项整合了多种技术的Web应用开发方案,这些技术包括PureMVC、Flex、BlazeDS、Spring和Hibernate。这篇文档可能是指导读者如何将这些技术结合在一起...
- **配置Spring**:首先,需要在Spring配置文件中定义数据源、SessionFactory(Hibernate的会话工厂)以及事务管理器。Spring能够管理和控制Hibernate的生命周期,简化了数据库操作。 - **配置Hibernate**:设置...
在 Flex 应用中,通常会通过 Spring 配置 iBATIS,创建 DAO(Data Access Object)层,实现与数据库的交互。 Cairngorm 和 pureMVC 是两种常用的 Flex 应用架构模式。Cairngorm 是一种轻量级的 MVC(Model-View-...
flex+spring+struts2+ibatis 整合的eclipse工程,可以导入eclipse环境下直接使用,因为加入开发的jar大于了上传的最大限制,只能把jar另外打包上传,下载可以从我上传资源的lib1,lib2下载,这个工程的搭建花费了我两...
在提供的压缩包文件"Flex+Spring+Hibernate Environment"中,可能包含了上述所有配置文件、源代码和部署资源。开发者可以通过直接部署运行,避免了从零开始搭建环境的繁琐过程。这个项目对于学习和理解Flex、Spring...
flex+spring+blazeds在MyEclipse下非常详细的结合配置
Flex、Hibernate 和 ...通过这些示例,你可以动手尝试配置和运行一个整合Flex、Hibernate和Spring的简单应用,进一步加深理解。在实际开发中,这种整合方式能够提供高性能、易维护的Web应用,满足复杂的业务需求。
- 在Spring配置文件中注册`EmployeeMapper`的Bean。 3. **更新Service实现**: - 修改`EmployeeServiceImpl`,使其能够通过MyBatis操作数据库。 ```java package com.sample.service.impl; import org.spring...
5. **整合过程**:接着,开发者需要在Spring配置文件中定义Bean,BlazeDS会自动暴露这些Bean为Flex客户端可调用的服务。在Flex客户端,通过使用AMF(Action Message Format)协议,可以调用这些服务并接收返回的数据...
flex+bleazeds+spring+hibernate配置的教程,有详尽过程,是flex与spring结合的不错的教程
1. 配置Spring服务器端:创建Spring配置文件,定义服务接口及其实现,使用Spring的`@Service`注解标记服务类。 2. 配置AMF通道:在服务器端集成BlazeDS或LCDS,配置AMF通道,使得Flex可以与Spring服务进行AMF通信。 ...
2. **Spring配置**:了解Spring的核心配置文件,如`applicationContext.xml`,用于定义Bean的实例化和依赖关系。 3. **Flex-Spring通信**:学习如何在Flex中使用 BlazeDS 或 GraniteDS 这样的中间件来与Spring服务...
3. 配置remoting-config.xml文件,这是Flex与服务器通信的关键配置,通常会涉及到Spring中的bean定义。 4. 添加Spring框架,包括过滤器、事务管理配置,以及数据库连接池配置。 5. 创建数据源相关文件,比如在src...
这个项目结合了前端的Flex(一种基于ActionScript和Flash的RIA开发框架)与后端的Spring(一个全面的Java应用框架)、Hibernate(一个对象关系映射框架)以及MySQL(一个流行的开源关系型数据库),实现了一个完整的...
2. **Spring配置**:在Spring中,需要配置服务代理(Service Proxy)以便Flex客户端可以调用。这些代理通常基于HTTPInvoker或RemotingDestination,使得Flex能够调用Spring Bean。 3. **数据访问对象(DAO)**:...