This article mainly introduces the uniqueness of Ajax verification users and the verification environment Ajax Jquery Json struts2. Interested friends can refer to it
For beginners, learn the practical practice of Ajax verification of user uniqueness It is to consolidate the basic knowledge of Ajax, Jquery, Json and Struts2. The specific content is as follows
Browse the renderings:
Operation stepsare as follows
1. First, we import the required packages and files Json package:struts2 org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter struts2 /*
Ajax+Jquery验证用户的唯一性
//验证用户的唯一性 public void isexist() throws IOException { boolean exist = name.equals("张三") ; JSONObject result=new JSONObject(); if(exist){ result.put("exist", true); }else{ result.put("exist", false); } ServletActionContext.getResponse().setContentType("text/html;charset=utf-8"); PrintWriter out=ServletActionContext.getResponse().getWriter(); out.println(result.toString()); out.flush(); out.close(); }
/login.jsp
How Ajax calls the restful interface to transmit Json format data (with code)
Boa server Ajax and cgi communication under (graphic tutorial)
Ajax Struts2 implements verification code verification function (graphic tutorial)
The above is the detailed content of Ajax verify user uniqueness. For more information, please follow other related articles on the PHP Chinese website!