⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 selectcountyajax1.java

📁 基于Java的地图数据管理软件。使用MySQL数据库管理系统。
💻 JAVA
字号:
/* 创建日期:Dec 13, 2006
 * 作  者:朱 闰
 * 公  司:安徽通途信息技术有限公司
 */

package com.tongtu.Action.userManage;

import java.io.IOException;
import java.io.PrintWriter;
import java.util.List;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import com.tongtu.Dao.DAOFactory;
import com.tongtu.Dao.user.UserDAO;
import com.tongtu.util.County;

public class SelectCountyAjax1 extends HttpServlet {

	static DAOFactory daoFactory = DAOFactory.getDAOFactory();
    
    protected static UserDAO getUserHelper(){
        return daoFactory.getUserDAO();
         
       }

	/**
	 * Constructor of the object.
	 */
	public SelectCountyAjax1() {
		super();
	}

	/**
	 * Destruction of the servlet. <br>
	 */
	public void destroy() {
		super.destroy(); // Just puts "destroy" string in log
		// Put your code here
	}

	/**
	 * The doGet method of the servlet. <br>
	 *
	 * This method is called when a form has its tag value method equals to get.
	 * 
	 * @param request the request send by the client to the server
	 * @param response the response send by the server to the client
	 * @throws ServletException if an error occurred
	 * @throws IOException if an error occurred
	 */
	public void doGet(HttpServletRequest request, HttpServletResponse response)
			throws ServletException, IOException {


		response.setContentType("text/xml");
		response.setCharacterEncoding("UTF-8");
	    response.setHeader("Cache-Control", "no-cache");
		
	 
	   	String secondtypevalue="<select name=\"county\" ><br><option value=\"0\" selected>请选择所在县(区)</option>";
	  
	    String bigtypeid=request.getParameter("cityId");  //获取城市用户帐号
	   
		
		List countyList=getUserHelper().getCountyListByCityCode(bigtypeid.substring(0,4));
		System.out.println("====cityid==" + bigtypeid);
		if(countyList!=null&&countyList.size()>0){
		for(int i=0;i<countyList.size();i++){
			County county =(County)countyList.get(i);
		  String countyCode = county.getCountyCode();
		  String countyName = county.getCountyName();
		  secondtypevalue=secondtypevalue+"<br><option value="+countyCode+">"+countyName+"</option>";
		  System.out.println("=========countyCode===" + countyCode + "====countyName==" + countyName);
		}
		}
		secondtypevalue=secondtypevalue+"</select>";
		
		secondtypevalue = secondtypevalue.replaceAll("<","&lt;");
		secondtypevalue = secondtypevalue.replaceAll(">","&gt;");
	    
		secondtypevalue = secondtypevalue.replaceAll("\"","&quot;");
		
		StringBuffer sb=new StringBuffer("<deptid>");
        sb.append("<secondtypevalue>"+secondtypevalue+"</secondtypevalue>");
        
        sb.append("</deptid>");
       PrintWriter out=response.getWriter();
       out.write(sb.toString());
       out.close();
	}

	

	/**
	 * Initialization of the servlet. <br>
	 *
	 * @throws ServletException if an error occure
	 */
	public void init() throws ServletException {
		// Put your code here
	}

}


⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -