Package demo

Source Code of demo.AjaxServlet

package demo;

import javax.servlet.*;
import javax.servlet.http.*;
import java.io.*;
import java.util.*;
import com.trulytech.mantis.system.ActionServlet;
import com.trulytech.mantis.system.SQLParser;
import com.trulytech.mantis.system.Permission;
import com.trulytech.mantis.util.Component;
import com.trulytech.mantis.result.DBResult;
import com.trulytech.mantis.util.AjaxUtil;
import com.trulytech.mantis.util.StringUtils;

public class AjaxServlet extends ActionServlet {

  // 重载身份校验函数
  protected int HasPermission(HttpServletRequest request,
      HttpServletResponse response, SQLParser Parser) throws Exception {
    return Permission.ALLOW;

  }

  public String showajax(HttpServletRequest request,
      HttpServletResponse response, SQLParser Parser) throws Exception

  {
    DBResult Result = Parser.QueryExecute("select id,label from PIECHART");
    String CommboBox = Component.ComboBox(Result, getParameter(request,
        "ID"), "ID", " onchange='javascript:changeselect()'", false,
        null);
    request.setAttribute("Com", CommboBox);

    return "ajax.jsp";
  }

  public String showmsg(HttpServletRequest request,
      HttpServletResponse response, SQLParser Parser) throws Exception

  {
    Thread.sleep(1000);
    return AjaxUtil.ShowMessage(response, StringUtils.randomString(20), "");
  }

  public String showCom(HttpServletRequest request,
      HttpServletResponse response, SQLParser Parser) throws Exception

  {
    DBResult Result = Parser
        .QueryExecute("select id,label from PIECHART where id=[_ID]");
    Thread.sleep(1000);
    return AjaxUtil.ShowSelect(response, Result);
  }

  public String showSuggestion(HttpServletRequest request,
      HttpServletResponse response, SQLParser Parser) throws Exception

  {
    DBResult Result = Parser
        .QueryExecute("select label from PIECHART where label like '%[_q]%'");

    return AjaxUtil.ShowSuggestion(response, Result);
  }

}
TOP

Related Classes of demo.AjaxServlet

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.