src/action/SelectServlet.java

(开头部分) 2KB

这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。

package action;

import java.io.IOException;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.HashMap;

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

import common.CommDAO;

public class SelectServlet extends HttpServlet {

	/**
	 * Constructor of the object.
	 */
	public SelectServlet() {
		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.setHeader("Cache-Control","no-cache");
	     String kcid = request.getParameter("id");
	     CommDAO dao = new CommDAO();
	     String ss = "select * from teacher where delstatus='0' and kcid="+kcid;
	     ArrayList<HashMap> list = (ArrayList)dao.select(ss);
	     String xml_start="<selects>";
	     String xml_end="</selects>";
	     String xml = "";
	     if(list.size()!=0){
	    	 for(HashMap m:list){
	    		 xml +="<select><value>"+m.get("id")+"</value><text>"+m.get("tname")+"</text></select>";
		     }
	     }
	     String last_xml=xml_start+xml+xml_end;
	     response.getWriter().write(last_xml);
后面还有 31 行代码,购买后查看完整代码

24 小时内免费解锁 3 个项目,之后 1 算力/个。 规则说明

AI 解读 AI

登录后可用,每次 10 算力,解读结果公开显示在下面。

还没有人解读过这个文件。