HelloBean.java package hessian.test.server; import java.io.Serializable; public class HelloBean implements Serializable { private static final long serialVersionUID = 570423789882653763L; private String name; private int age; public String getName() { return name; } public void setName(String name) { this.name = name; } public int getAge(){ return age; } public void setAge(int age){ this.age = age; } } ComplexData.java package hessian.test.server; import java.io.Serializable; import java.util.ArrayList; import java.util.HashMap; import java.util.Map; public class ComplexData implements Serializable{ private static final long serialVersionUID = 1L; private ArrayList<HelloBean> helloBeans; //private Map<String, HelloBean> helloBeanMap; private int number; public int getNumber(){ return number; } public ArrayList<HelloBean> getHelloBeans(){ return helloBeans; } public void setData(ArrayList<HelloBean> beans, int num){ this.number = num; this.helloBeans = beans; // helloBeanMap = new HashMap<String, HelloBean>(); // for (HelloBean helloBean : beans) { // if(!helloBeanMap.containsKey(helloBean.getName())) // { // helloBeanMap.put(helloBean.getName(), helloBean); // } // } } } web.xml内容: <?xml version="1.0" encoding="UTF-8"?> <web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd" id="WebApp_ID" version="3.0"> <display-name>hessian server</display-name> <servlet> <servlet-name>hessian</servlet-name> <servlet-class>com.caucho.hessian.server.HessianServlet</servlet-class> <init-param> <param-name>service-class</param-name> <param-value>hessian.test.server.HelloImpl</param-value> </init-param> </servlet> <servlet-mapping> <servlet-name>hessian</servlet-name> <url-pattern>/hessian</url-pattern> </servlet-mapping> </web-app> |