昨天才知道原来flex2.0和
jsp可以通信,并且很简单。
我先说flex2.0接受数据(如果熟悉flex2.0,应该都知道adobe官方的flexstore,那么
我就以他作为例子说明一下):当然flex2.0要通过HTTPService接受数据,以前如果用过他来接受xml数据那就简单了,比如:你以前的数据是:
xml version="1.0" encoding="utf-8" ?>
- <catalog>
- <product productId="1">
<description>Easy to use without sacrificing style。description>
<image>assets/pic/Nokia_6010.gifimage>
<highlight1>MMShighlight1>
<highlight2>Large color displayhighlight2>
product>
- <product productId="2">
<name>Nokia 3100 Bluename>
<description>Light up the night with ……description>
<image>assets/pic/Nokia_3100_blue.gifimage>
<highlight1>Glow-in-the-darkhighlight1>
<highlight2>Flashing lightshighlight2>
product>
……
catalog>
你只需要将原来的xml数据文件改成这样:
<%@ page language="java" import="java.util.*" pageEncoding="ISO-8859-1"%>
<%@ page import="hibernate.*" %>
<%PhoneDao pd=new PhoneDao();//这是从Jsp里接受数据的的源
List list=(List)pd.getallphoneinfo();
for(int i=0;i
out.println(""+phone.getName()+"name>");
out.println(""+phone.getDescription()+"description>");
out.println(" "+phone.getPrice()+"price>");
out.println(""+phone.getImage()+"image>");
out.println(""+phone.getSeries()+"series>");
out.println(" "+phone.getTriband()+"triband>");
out.println(""+phone.getCamera()+"camera>");
out.println("
当然你若想看懂上面的代码,你必须同时有flex和jsp的基础。源代码太大了