第一次在CSDN上写东西,小试一下,呵呵!
我的环境是Eclipse3.4.2+Flex Builder3.0.2 + Flex SDK3.3 + Tomcat6.0.18
这次用了BlazeDS.war和WebTier.war的结合,单独的BlazeDs.war不能在线编译啊
弄了好长时间的环境,终于把目前的问题解决了
首先说一点,在学校上网示范是用Dr.COM客户端的同学,请暂时不要用3.72版本的,虽然说城市热点提供的3.72版本的客户端增加了断线自动登录,可是3.72版本的客户端与Tomcat发生冲突,在安装3.72客户端的情况下Tomcat启动不了(从外部启动可以实现,既cmd - net start tomcat6,而在Eclipse里面无法启动)。这个问题困扰了我很长时间,万万没想到竟然是和学校上网客户端冲突
FlexModule_j2ee中有个WebTier.war(从国外某Blog上找到的地址,既然上面写latest应该就是最新版本的吧)
http://flexorg.wip3.adobe.com/modules/latest/FlexModule_j2ee.zip
BlazeDS.war下载
http://download.macromedia.com/pub/opensource/blazeds/blazeds_bin_3-0-0-544.zip
Eclipse + Flex Builder的插件应该不用多说了
用了lcds2.6里头的war文件也是不能在线编译,现在说BlazeDS是新出来的用与Flex连接Java的新东东
在新建工程的时候
Flex War File: 则选用BlazeDS.war,其实就是WebContent里面的一些配置文件而已
然后将Web Tier里头的WEB-INF文件夹下lib文件拷贝到工程下的WEB-INF对应文件夹下
WEB-INF文件夹下flex文件夹内除了service-config.xml文件外,都拷贝到工程对应的文件夹下
然后把WebContent/WEB-INF/web.xml内容替换如下
这部分是转载(其实是LiveCycle DataService 里面的配置文件)
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN" "http://java.sun.com/dtd/web-app_2_3.dtd">
<web-app>
<display-name>LiveCycle Data Services Samples</display-name>
<description>LiveCycle Data Services Application with Samples</description>
<!-- start from webtier web.xml -->
<context-param>
<param-name>flex.class.path</param-name>
<param-value>/WEB-INF/flex/hotfixes,/WEB-INF/flex/jars</param-value>
</context-param>
<!-- end from webtier web.xml -->
<!-- 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>PDFResourceServlet</servlet-name>
<display-name>Helper for retrieving dynamically generated PDF documents.</display-name>
<servlet-class>flex.samples.pdfgen.PDFResourceServlet</servlet-class>
</servlet>
<!-- start from webtier web.xml -->
<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>
<!-- end from webtier web.xml -->
<servlet-mapping>
<servlet-name>MessageBrokerServlet</servlet-name>
<url-pattern>/messagebroker/*</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>PDFResourceServlet</servlet-name>
<url-pattern>/dynamic-pdf/*</url-pattern>
</servlet-mapping>
<!-- start from webtier web.xml -->
<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>
<!-- end from webtier web.xml -->
<welcome-file-list>
<welcome-file>index.html</welcome-file>
<welcome-file>index.htm</welcome-file>
</welcome-file-list>
<!-- start from webtier web.xml -->
<taglib>
<taglib-uri>FlexTagLib</taglib-uri>
<taglib-location>/WEB-INF/lib/flex-bootstrap-jsp.jar</taglib-location>
</taglib>
<!-- end from webtier web.xml -->
<login-config>
<auth-method>BASIC</auth-method>
</login-config>
</web-app>
这样Run as就可以在线编译了
不过每次这样复制很麻烦啊,那么在WebContent文件夹下Shift右键w 在当前窗口打开控制台(WinNT6.0后的操作系统)然后 jar -cvf BlazeDS.war *
完成之后就做出了个BlazeDS.war文件,下次新建工程的时候直接加载这个Flex War File就可以了
俺是新手啊,尝试一下,写个小文章,呵呵,多多指教
http://blog.csdn.net/Li_yunpeng/archive/2009/04/20/4095049.aspx