<servlet> <servlet-name>dwr-invoker</servlet-name> <display-name>DWR Servlet</display-name> <description>Direct Web Remoter Servlet</description> <servlet-class>org.directwebremoting.servlet.DwrServlet</servlet-class>
<!-- This should NEVER be present in live --> <init-param> <param-name>debug</param-name> <param-value>true</param-value> </init-param>
<!-- Remove this unless you want to use active reverse ajax --> <init-param> <param-name>activeReverseAjaxEnabled</param-name> <param-value>true</param-value> </init-param>
<!-- By default DWR creates application scope objects when they are first used. This creates them when the app-server is started --> <init-param> <param-name>initApplicationScopeCreatorsAtStartup</param-name> <param-value>true</param-value> </init-param>
<!-- This enables full streaming mode. It‘s probably better to leave this out if you are running across the internet --> <init-param> <param-name>maxWaitAfterWrite</param-name> <param-value>-1</param-value> </init-param>
<!-- For more information on these parameters, see: - http://getahead.org/dwr/server/servlet - http://getahead.org/dwr/reverse-ajax/configuration -->
<!-- intro - for the test on index.html --> <create creator="new" javascript="Intro"> <param name="class" value="org.getahead.dwrdemo.intro.Intro"/> </create>
public class DWRService { /*public List<City> getPropive (){ ICityDao dao = new CityDao(); List<City> list =dao.findByParentId(0); for (City city : list) { System.out.println(city.getCityId()+"..."+city.getCityName());
} System.out.println(list.size()); return list;
}*/ public Map<Integer,String> getPropive (){ ICityDao dao = new CityDao(); List<City> list =dao.findByParentId(0); Map<Integer,String> map = new HashMap<Integer,String>(); for (City city : list) { //System.out.println(city.getCityId()+"..."+city.getCityName()); map.put(city.getCityId(), city.getCityName()); } return map;
} public Map<Integer,String> getCity(int id){
ICityDao dao = new CityDao(); List<City> list =dao.findByParentId(id); Map<Integer,String> map = new HashMap<Integer,String>(); for (City city : list) { //System.out.println(city.getCityId()+"..."+city.getCityName()); map.put(city.getCityId(), city.getCityName()); } return map;
} public Map<Integer,String> getQu(int id){
ICityDao dao = new CityDao(); List<City> list =dao.findByParentId(id); Map<Integer,String> map = new HashMap<Integer,String>(); for (City city : list) { //System.out.println(city.getCityId()+"..."+city.getCityName()); map.put(city.getCityId(), city.getCityName()); } return map;