2009-08-19 6 views
3

既存のspring-MVC-Projectをflexに統合する最良の方法はどれですか。 Spring-2.5のlibをアノテーションとともに使用しています。BlazeDS上でのSpring MVCとFlexの統合?

例えば私のリストコントローラ:

package xxx.xxx.controller; 

@Controller 
public class ListController { 

@Autowired 
private ColorHome colorHome; 

@RequestMapping("/admin/colors.do") 
public ModelMap colorsHandler() { 
    Collection<Object> colors = this.colorHome 
      .findColors(); 
    return new ModelMap(colors); 
} 

私はまた、色を表示するcolors.jspを持っています。今私はフレックスをUIレイヤーとして統合したいと思います。私は上記のRequestMappingsとSpring-Viewを統合する必要があります。

答えて

1

Go get BlazeDS。 WARファイルを使用してインストールします。 また、SpringからFlex Jarが必要になります。 web.xmlファイルで

、これを追加します。

<context-param> 
    <param-name>contextConfigLocation</param-name> 
    <param-value> 
     /WEB-INF/flexContext.xml 
    </param-value> 
</context-param> 
<servlet> 
    <servlet-name>flex</servlet-name> 
    <servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class> 
    <load-on-startup>1</load-on-startup> 
</servlet> 
<servlet-mapping> 
    <servlet-name>flex</servlet-name> 
    <url-pattern>/messagebroker/*</url-pattern> 
</servlet-mapping> 

は、フレックスservlet.xmlファイルを作成します。

<?xml version="1.0" encoding="UTF-8"?> 
<beans xmlns="http://www.springframework.org/schema/beans" 
     xmlns:flex="http://www.springframework.org/schema/flex" 
     xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
     xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd"> 
</beans> 

flexContext.xmlファイルを作成します。

<?xml version="1.0" encoding="UTF-8"?> 
<beans xmlns="http://www.springframework.org/schema/beans" 
xmlns:flex="http://www.springframework.org/schema/flex" 
    ... 
"> 
    <flex:message-broker /> 

    <flex:remoting-destination destination-id="flexService" ref="beanFromApplicationContext" /> 

</beans> 

これは、リモートエンドポイントを取得するのに十分なはずです。

Flexでは、remoteObjectを作成し、それに "flexService"の宛先を指定するか、toにdestination-idを設定します。

関連する問題