96 lines
4.6 KiB
Java
96 lines
4.6 KiB
Java
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", "<!-- Other plugins ( load only nessesary plugins for every page) -->\n"
|
|
+ " <script src=\"static/assets/plugins/charts/flot/jquery.flot.js\"></script>\n"
|
|
+ " <script src=\"static/assets/plugins/charts/flot/jquery.flot.pie.js\"></script>\n"
|
|
+ " <script src=\"static/assets/plugins/charts/flot/jquery.flot.resize.js\"></script>\n"
|
|
+ " <script src=\"static/assets/plugins/charts/flot/jquery.flot.time.js\"></script>\n"
|
|
+ " <script src=\"static/assets/plugins/charts/flot/jquery.flot.growraf.js\"></script>\n"
|
|
+ " <script src=\"static/assets/plugins/charts/flot/jquery.flot.categories.js\"></script>\n"
|
|
+ " <script src=\"static/assets/plugins/charts/flot/jquery.flot.stack.js\"></script>\n"
|
|
+ " <script src=\"static/assets/plugins/charts/flot/jquery.flot.tooltip.min.js\"></script>\n"
|
|
+ " <script src=\"static/assets/plugins/charts/flot/date.js\"></script>\n"
|
|
+ " <script src=\"static/assets/plugins/charts/sparklines/jquery.sparkline.js\"></script>\n"
|
|
+ " <script src=\"static/assets/plugins/charts/pie-chart/jquery.easy-pie-chart.js\"></script>\n"
|
|
+ " <script src=\"static/assets/plugins/forms/icheck/jquery.icheck.js\"></script>\n"
|
|
+ " <script src=\"static/assets/plugins/forms/tags/jquery.tagsinput.min.js\"></script>\n"
|
|
+ " <script src=\"static/assets/plugins/forms/tinymce/tinymce.min.js\"></script>\n"
|
|
+ " <script src=\"static/assets/plugins/misc/highlight/highlight.pack.js\"></script>\n"
|
|
+ " <script src=\"static/assets/plugins/misc/countTo/jquery.countTo.js\"></script>\n"
|
|
+ " <script src=\"static/assets/plugins/ui/weather/skyicons.js\"></script>\n"
|
|
+ " <script src=\"static/assets/plugins/ui/notify/jquery.gritter.js\"></script>\n"
|
|
+ " <script src=\"static/assets/plugins/ui/calendar/fullcalendar.js\"></script>\n"
|
|
+ " <script src=\"static/assets/js/jquery.sprFlat.js\"></script>\n"
|
|
+ " <script src=\"static/assets/js/app.js\"></script>\n"
|
|
+ " <script src=\"static/assets/js/pages/dashboard.js\"></script>");
|
|
return mv;
|
|
}
|
|
|
|
}
|