chinaifae

Ajax验证

import javax.servlet.http.HttpServletRequest;

import org.slf4j.Logger;

import org.slf4j.LoggerFactory;

 

public class AjaxUtil

{

  private static final Logger LOGGER = LoggerFactory.getLogger(AjaxUtil.class);

 

  public static boolean checkIsAjax(HttpServletRequest request)

  {

    String requestType = request.getHeader("x-requested-with");

    boolean isAjax = false;

    if ((requestType != null) && (requestType.equals("XMLHttpRequest"))) {

      isAjax = true;

    }

 

    request.setAttribute("isAjax", Boolean.valueOf(isAjax));

    return isAjax;

  }

}

分类:

技术点:

相关文章:

  • 2022-12-23
  • 2021-07-12
  • 2021-11-21
  • 2021-11-17
  • 2021-11-17
  • 2021-07-20
  • 2021-09-15
猜你喜欢
  • 2022-12-23
  • 2022-01-02
  • 2021-07-15
  • 2021-11-17
  • 2022-02-10
  • 2021-05-23
相关资源
相似解决方案