content: package com.wipro.controller;
  
  import javax.servlet.http.HttpServletRequest;
  import javax.servlet.http.HttpServletResponse;
  
  import org.springframework.beans.factory.annotation.Autowired;
  import org.springframework.stereotype.Controller;
  import org.springframework.web.bind.annotation.ModelAttribute;
  import org.springframework.web.bind.annotation.RequestMapping;
  import org.springframework.web.bind.annotation.RequestMethod;
  import org.springframework.web.servlet.ModelAndView;
  
  import com.wipro.model.Login;
  import com.wipro.model.User;
  import com.wipro.service.UserService;
  
  @Controller
  public class LoginController {
  	
  	@Autowired
  	UserService userService;
  	  @RequestMapping(value = "/login", method = RequestMethod.GET)
  	  public ModelAndView showLogin(HttpServletRequest request, HttpServletResponse response) {
  	    ModelAndView mav = new ModelAndView("login");
  	    mav.addObject("login", new Login());
  	    return mav;
  	  }
  	  @RequestMapping(value = "/loginProcess", method = RequestMethod.POST)
  	  public ModelAndView loginProcess(HttpServletRequest request, HttpServletResponse response,
  	  @ModelAttribute("login") Login login) {
  	    ModelAndView mav = null;
  	    User user = userService.validateUser(login);
  	    if (null != user) {
  	    mav = new ModelAndView("welcome");
  	    mav.addObject("name", user.getEmpname());
  	    } else {
  	    mav = new ModelAndView("login");
  	    mav.addObject("message", "Username or Password is wrong!!");
  	    }
  	    return mav;
  	  }
  }
  