city.jsp
上传用户:zaktkj
上传日期:2022-08-08
资源大小:5770k
文件大小:2k
源码类别:

JavaScript

开发平台:

JavaScript

  1. <%@ page contentType="text/html;charset=utf-8"%>
  2. <%!
  3.     String province = "[['河北','河北'],['内蒙古','内蒙古']]";
  4.     String cityHebei = "[" +
  5.         "['唐山','唐山']," +
  6.         "['秦皇岛','秦皇岛']," +
  7.         "['承德','承德']," +
  8.         "['张家口','张家口']" +
  9.     "]";
  10.     String cityNeimenggu = "[" +
  11.         "['呼和浩特','呼和浩特']," +
  12.         "['包头','包头']" +
  13.     "]";
  14.     String countyTangshan = "[" +
  15.         "['路南区','路南区']," +
  16.         "['路北区','路北区']," +
  17.         "['开平区','开平区']," +
  18.         "['古冶区','古冶区']," +
  19.         "['丰润区','丰润区']," +
  20.         "['丰南区','丰南区']," +
  21.         "['玉田','玉田']," +
  22.         "['遵化','遵化']," +
  23.         "['迁西','迁西']," +
  24.         "['迁安','迁安']," +
  25.         "['滦县','滦县']," +
  26.         "['滦南','滦南']," +
  27.         "['乐亭','乐亭']," +
  28.         "['唐海','唐海']" +
  29.     "]";
  30.     String countyUnknow = "[['不知道','不知道']]";
  31. %>
  32. <%
  33. request.setCharacterEncoding("UTF-8");
  34. response.setCharacterEncoding("UTF-8");
  35. String type = request.getParameter("type");
  36. if ("province".equals(type)) {
  37.     response.getWriter().print(province);
  38. } else if ("city".equals(type)) {
  39.     String province = java.net.URLDecoder.decode(request.getParameter("id"));
  40.     System.out.println(province);
  41.     if ("河北".equals(province)) {
  42.         response.getWriter().print(cityHebei);
  43.     } else if ("内蒙古".equals(province)) {
  44.         response.getWriter().print(cityNeimenggu);
  45.     }
  46. } else if ("county".equals(type)) {
  47.     String city = request.getParameter("id");
  48.     if ("唐山".equals(city)) {
  49.         response.getWriter().print(countyTangshan);
  50.     } else {
  51.         response.getWriter().print(countyUnknow);
  52.     }
  53. }
  54. %>