package com.ifish.controller;
import com.ifish.helper.SecurityService;
import com.ifish.util.SpringSecurityUtils;
import javax.servlet.http.HttpServletRequest;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.servlet.ModelAndView;
import javax.servlet.jsp.jstl.core.Config;
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
/**
*
* @author Administrator
*/
@Controller
public class Index {
@Autowired
private SecurityService securityService;
@RequestMapping(value = "/login", method = RequestMethod.GET)
public ModelAndView login(
@RequestParam(value = "error", required = false) String error,
@RequestParam(value = "logout", required = false) String logout,
String ReturnUrl, HttpServletRequest request) {
ModelAndView mv = new ModelAndView();
if (error != null) {
if (StringUtils.isNotBlank(error)) {
mv.addObject("error", error);
} else {
mv.addObject("error", "用户名密码不对!");
}
}
if (logout != null) {
mv.addObject("msg", "退出成功.");
if (StringUtils.isNotBlank(ReturnUrl)) {
mv.setViewName("redirect:/");
return mv;
}
}
mv.setViewName("login");
return mv;
}
@RequestMapping(value = "/test", method = RequestMethod.GET)
public Object test() {
ModelAndView mv = new ModelAndView();
mv.setViewName("testj");
return mv;
}
@RequestMapping(value = {"", "/", "index"}, method = RequestMethod.GET)
public ModelAndView test1() {
ModelAndView mv = new ModelAndView();
mv.setViewName("index");
mv.addObject("myjs", "\n"
+ " \n"
+ " \n"
+ " \n"
+ " \n"
+ " \n"
+ " \n"
+ " \n"
+ " \n"
+ " \n"
+ " \n"
+ " \n"
+ " \n"
+ " \n"
+ " \n"
+ " \n"
+ " \n"
+ " \n"
+ " \n"
+ " \n"
+ " \n"
+ " \n"
+ " ");
return mv;
}
}