SHARE
TWEET

Untitled

a guest Oct 4th, 2017 49 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. @RequestMapping(value = "/validate", method = RequestMethod.POST)
  2. @ResponseBody
  3. public ModelAndView(HttpServletRequest request, HttpServletResponse response, Model model) {
  4.     String userName = request.getParameter("userName");
  5.     String password = request.getParameter("password");
  6.     boolean validuser=employeeService.checkLogin(userName,password);
  7.     if(validuser == true)
  8.     {
  9.         model.setViewName("success");
  10.         return model;
  11.     }
  12.     model.setViewName("login");
  13.     return model;
  14. }
  15.    
  16. $(document).ready(function() {
  17.       $("form").submit(function() {
  18.          var userName=$("#inputEmail").val();
  19.          var password=$("#inputPassword").val();
  20.             $.ajax({
  21.                 type : "post",
  22.                 url : "${pageContext.request.contextPath}/validate",
  23.                 data : {userName:userName, password:password},
  24.                 success:function(data){
  25.                     alert(data);        
  26.                 },
  27.                 error:function()
  28.                 {
  29.                     alert("Error ");
  30.                 }        
  31.                 });
  32.       });
  33.     });
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top