package lee;
import java.util.List;
import java.util.ArrayList;
import java.util.Map;
import java.util.HashMap;
/**
* @author yeeku.H.lee kongyeeku@163.com
* @version 1.0
* <br>Copyright (C), 2005-2008, yeeku.H.Lee
* <br>This program is protected by copyright laws.
* <br>Program Name:
* <br>Date:
*/
public class HelloDwr
{
public String hello(String name)
{
return name + ",您好!您已经开始了DWR的学习之旅,祝您学得开心...";
}
public String sendObj(Person p )
{
return p.getName() + ",您好!您已经学会了使用JavaBean参数...";
}
public Person getBean(String name)
{
return new Person("服务器端" + name);
}
public Cat getObject(String name)
{
return new Cat("服务器端" + name);
}
public List<Person> getPersonList()
{
List<Person> result = new ArrayList<Person>();
result.add(new Person("集合aaaa"));
result.add(new Person("集合bbbb"));
result.add(new Person("集合cccc"));
return result;
}
public Person[] getPersonArray()
{
Person[] result = new Person[3];
result[0] = new Person("数组aaaa");
result[1] = new Person("数组bbbb");
result[2] = new Person("数组cccc");
return result;
}
public Map<String, Person> getPersonMap()
{
Map<String, Person> result = new HashMap<String, Person>();
result.put("first" , new Person("Map aaaa"));
result.put("second" , new Person("Map bbb"));
result.put("third" , new Person("Map cccc"));
return result;
}
public String sendList(List<Person> pl)
{
String result = "";
for (Person p : pl)
{
result += p.getName() + "<br>";
}
return result;
}
public String sendMap(Map<String , Person> pmap)
{
String result = "";
for (String key : pmap.keySet())
{
result += "键" + key + " 其值为:" + pmap.get(key).getName() + "<br>";
}
return result;
}
}
dwr入门例子 返回list
需积分: 9 55 浏览量
2008-09-09
21:54:28
上传
评论 1
收藏 821KB RAR 举报
tyl_425
- 粉丝: 0
- 资源: 2