热点
UX视角:编程语言、函数与变量控制核心技巧,reasoning_content:我们要求以用户体验设计师的口吻,写一个与“技术、科技”相关,关于“互联网创业编程核心:语言选择、函数运用与变量控制技巧”的标题需要简短精炼,30字以内直接输出标题,不要额外说明nn考虑到用户体验设计师视角,标题可以强调用户体验与技术选择的关系,但核心是编程核心可能结合“体验”、“设计”、“高效”等词例如:“从用户出发:编程语言与函数变量优化秘籍” 但需要更精炼nn建议“创业编程核心:语言、函数与变量的用户体验设计” 但字数可能超或者“用户视角:编程语言、函数与变量控制技巧” 20字左右nn再想:用户体验设计师通常关注直觉、流畅、易用可以写:“直觉式编程:语言选择、函数与变量控制的艺术” 但可能偏离nn更直接:“互联网创业:编程语言、函数与变量控制秘诀” 但缺少用户体验元素nn要求是“以用户体验设计师的口吻”,所以标题中应体现设计师身份例如:“用户体验设计师教你:编程语言、函数与变量控制技巧” 但字数可能超(22字?算一下:“用户体验设计师教你:编程语言、函数与变量控制技巧” 共20个中文字?不,标点算吗?实际“用户体验设计师教你:编程语言、函数与变量控制技巧” 共22个汉字字符可以接受30字内但可能不够精炼nn另一个:“设计思维编程:语言、函数与变量控制核心” 13字nn或者:“从体验到代码:语言、函数与变量控制技巧” 14字nn考虑要求“与‘技术、科技’相关”,标题本身是科技内容最佳:“UX视角:编程语言、函数与变量控制核心技巧” 18字其中“UX”是用户体验缩写,符合nn直接输出
5G安全新生态:护航移动互联未来,reasoning_content:我们要求以网络安全工程师的口吻,写一个与“技术、科技”相关,关于“5G技术引领未来,构建移动互联新生态”的标题需要直接输出一个标题,不要加说明提示等,字数控制在30字以内nn思考:网络安全工程师的口吻,可能会强调安全、防护、信任、边界等角度但标题要围绕“5G技术引领未来,构建移动互联新生态”,所以需要结合5G和网络安全可能的标题如:“5G新生态:筑牢移动互联安全防线”或“5G赋能未来,安全护航新生态”注意字数限制nn简洁:5G安全新生态,护航移动互联未来或者:5G技术引领未来,安全构建新生态但需要体现网络安全工程师视角nn最佳:5G未来,安全为基——构建移动互联新生态但字数?可能超更短:5G新生态:安全护航互联未来字数:11字或者:5G安全:构建移动互联新生态字数12字或者:5G技术引领,安全筑牢新生态字数14字nn用网络安全工程师口吻,可以加“守护”、“防线”等例如:5G引领未来,安全守护新生态或者:5G新生态,安全工程师的守护nn但标题需要是完整的我想到一个:5G未来,安全先行——构建移动互联新生态字数:18字符合nn或者:5G技术引领,安全构建互联新生态字数:16字nn最终选择一个:5G安全新生态:护航移动互联未来字数:13字
16 9 月 2026, 周三

手把手教你使用flex eclipse整合spring

副标题#e#

最先下载FlashBuilder_4_7_LS10_win64.exe试了几个eclipse安装插件都没成功,包括myeclipse8.5、spring sts2.9.2、eclipse3.5、j2eeeclipse版本4.2.0,后来搞了一个FlashBuilder_4_LS10.exe安装完找不到插件安装文件原来这个是单独版,必须插件版才行,最后下载FlashBuilder_4_Plugin_LS10.exe终于配置成功了,myeclipse8.5不行,spring sts可以了。

spring sts部署应用跟myeclipse不一样,比较类似eclipse。

用sts整合flex和java有几个步骤:

1:新建动态web工程flexweb,创建web.xml

2: blazeds-turnkey-4.0.0.14931.zip解压, 复制blazed两个文件夹flex和lib到WEB-INF下,里面是blaze的jar包和flex配置文件,然后修改web.xml加入blaze支持

<listener>
<listener-class>flex.messaging.HttpFlexSession</listener-class>
</listener>
<!-- MessageBroker Servlet -->
<servlet>
<servlet-name>MessageBrokerServlet</servlet-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-mapping>
<servlet-name>MessageBrokerServlet</servlet-name>
<url-pattern>/messagebroker/*</url-pattern>
</servlet-mapping>

3:项目右键,添加/更改项目类型>添加flex类型项目,第一步,应用程序类型选择J2EE,下方选择BlazeDS,第二部根文件夹填入项目在workspase的路径加一个WebContent,如E:\workspaces\sts\flexweb\WebContent,根URL填:8080/flexweb,上下文根目录/flexweb,输出文件夹使用默认E:\workspaces\sts\flexweb\WebContent\flexweb-debug,点击finish
4:转换完成后,目录有些变化,右键项目>properties>flex构建路径,主源文件夹改为flex_src,然后把自动生成的src目录下的flexweb.mxml移动到flex_src下,环境搭建就算完成了

HelloWorld

flexweb.mxml:

<?xml version="1.0" encoding="utf-8"?>
<s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:s="library://ns.adobe.com/flex/spark"
xmlns:mx="library://ns.adobe.com/flex/mx" minWidth="955" minHeight="600">
<fx:Script>
<![CDATA[
import mx.controls.Alert;
import mx.rpc.events.ResultEvent;
protected function myFlex_resultHandler(event:ResultEvent):void{
var name:String=event.result as String;
Alert.show(name);
}
protected function button1_clickHandler(event:MouseEvent):void
{
myFlex.sayHello(txtName.text);
}
]]>
</fx:Script>
<fx:Declarations>
<!-- 将非可视元素(例如服务、值对象)放在此处 -->
<s:RemoteObject destination="mytest" result="myFlex_resultHandler(event)"/>
</fx:Declarations>
<s:Button x="209" y="135" label="按钮"/>
<s:TextInput x="166" y="81"/>
<s:Label x="10" y="81" text="请输入内容:" fontSize="15" fontWeight="bold" fontFamily="中易黑体"/>
</s:Application>

其中

<s:RemoteObject destination="mytest" result="myFlex_resultHandler(event)"/>

指定了一个调用Java的类Hello,mytest对应到remoting-config.xml

在WEB-INFO/flex目录下remoting-config.xml加入

<destination>
<properties>
<source>com.hongbo.Hello</source>
</properties>
</destination>

result对应的是java方法调用的回调函数
建一个普通java类

package com.hongbo;

public class Hello {
public String sayHello(String name){
System.out.println("------------------------------------");
return "Hello First Demo " + name;
}
}

这样就OK了

访问路径是:8080/flexweb/flexweb-debug/flexweb.html

第一次会报404,problems提示无法创建html包装器,右键点击重新创建模板

添加Spring支持

1:web.xml加入

<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>/WEB-INF/classes/applicationContext.xml </param-value>
</context-param>
<listener>
<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
</listener>

2:src下创建applicationContext.xml

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

3:WEB-INF/flex/service-config.xml加入

<factories>
<factory />
</factories>

添加java类

package com.hongbo;
import org.springframework.beans.BeansException;
import org.springframework.beans.factory.NoSuchBeanDefinitionException;
import org.springframework.context.ApplicationContext;
import org.springframework.web.context.support.WebApplicationContextUtils;
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 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:修改remoting-config.xml

<destination>
<properties>
<factory>spring</factory>
<source>hello</source>
</properties>
</destination>

5:修改相应的Java类

#p#副标题#e##p#分页标题#e#

package com.hongbo;

import com.hongbo.test.TestSpring;

public class Hello {
private TestSpring testSpring;
public void setTestSpring(TestSpring testSpring) {
this.testSpring = testSpring;
}
public String sayHello(String name){
return testSpring.testSpring(name);
}
}

package com.hongbo.test;

public interface TestSpring {
String testSpring(String name);
}

package com.hongbo.test.impl;

import com.hongbo.test.TestSpring;

public class TestSpringImpl implements TestSpring{
public String testSpring(String name){
System.out.println("test spring-------------------------------------"+name);
return "test spring "+name;
}
}

最后,flex打印语句trace不会打印到控制台,要先卸载flashplayer再安装一个debuger版的flashplayer,下载flashplayer_uninstall.zip,卸载,下载flashplayer10r12_36_winax_debug.exe,安装,卸载安装后好像谷歌浏览器没影响,然后eclipse修改默认浏览器为IE,window>preferences>General>Web browser,选择Internet Explorer,最后还有,启动tomcat后,必须在mxml上面右键debug运行,打开的IE才会打印trace,直接访问网址是不行的。
如有遗漏请指出

dawei

【声明】:毕节站长网内容转载自互联网,其相关言论仅代表作者个人观点绝非权威,不代表本站立场。如您发现内容存在版权问题,请提交相关链接至邮箱:bqsm@foxmail.com,我们将及时予以处理。

您错过了