Package com.controllers

Source Code of com.controllers.EmpController

package com.controllers;

import java.util.*;
import com.form.EmpLginDetform;
import com.form.ValidationForm;
import java.util.Map;
import javax.validation.Valid;
import org.springframework.stereotype.Controller;
import org.springframework.validation.BindingResult;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;

import com.form.EmpLginDetform;


@Controller
@RequestMapping("/EmpLginDetform.html")
public class EmpController {
  @RequestMapping(method = RequestMethod.GET)
  public String emplogingpage(Map model)
  {
      EmpLginDetform EmpLginDetform=new EmpLginDetform();
      model.put("EmpLginDetform", EmpLginDetform);
      return "EmpLogin";
  }

  @RequestMapping(method=RequestMethod.POST )
  public String emploginsubmit(@Valid EmpLginDetform EmpLginDetform,BindingResult errorresults,Map model)
  {
    if(errorresults.hasErrors())
    {
      List  errors=errorresults.getAllErrors();
      Iterator ite=errors.iterator();
      while(ite.hasNext())
      {
        System.out.println("erros is:-"+ite.next());
      }
       
      System.out.println("in errors"+errorresults.getErrorCount());
      model.put("EmpLginDetform", EmpLginDetform);
      return "EmpLogin";
    }
    else
    {
      model.put("EmpLginDetform", EmpLginDetform);
    return "dummyPage";
    }
  }

}
TOP

Related Classes of com.controllers.EmpController

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.