@Controller
@RequestMapping( { "/entlogin.jtml" })
public class EntLoginController {
@Autowired
private EntSecurityService entSecurityService;
@Autowired
private EntMenuService entMenuService;
/**
* 返回void 则对应请求URL的.jtml变成.jsp
*
* @param model
*/
@RequestMapping(method = RequestMethod.GET)
public void loginGet(Model model) {
model.addAttribute("systemConfig", ConfigCacheDao.SystemConfigCache);
// add code
}
/**
* 后台登陆
*
* @return
*/
@RequestMapping(method = RequestMethod.POST)
public String login(Model model,
@ModelAttribute("user") EnterpriseUser enterpriseUser) {
model.addAttribute("systemConfig", ConfigCacheDao.SystemConfigCache);
boolean bl = entSecurityService.login(enterpriseUser);
if (!bl) {
model.addAttribute("msg", "用户名密码错误!");
return "entlogin";
} else{
EnterpriseUser u = entSecurityService.getCurrentUser();
List<EntMenu> menuList = entMenuService.getMenuByUser(u);
u.setMenuList(menuList);
return "entlogin.jtml";
}
}
公司的一个以前的项目,最近在看,这里有一点不明白,if(!bl) return 的是一个页面entlogin.jsp我能理解,但是else 返回的怎么是个带后缀名的return "entlogin.jtml";
难道有entlogin.jtml.jsp这样一个页面? 求解答啊。。
java string return
------解决方案--------------------
不清楚,应该是jsp + html吧,就当jsp页面就可以了,
类似的还有jspf文件等等。。
------解决方案--------------------
你看看程序不就知道了吗
------解决方案--------------------
if (!bl) {
改成 if (false)
debug看看结果是啥样的。。。