LoginController.java
789 Bytes
package fr.plil.sio.web.mvc;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.servlet.ModelAndView;
@Controller
public class LoginController {
@RequestMapping(value = "/login", method = RequestMethod.GET)
public ModelAndView login(String error, String logout) {
ModelAndView modelAndView = new ModelAndView("login");
if (error != null) {
modelAndView.addObject("error", "Your username and password is invalid.");
}
if (logout != null) {
modelAndView.addObject("message", "You have been logged out successfully.");
}
return modelAndView;
}
}