日期:2014-05-17  浏览次数:20667 次

关于springMVC注解 return 的问题。。

@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文件等等。。
------解决方案--------------------
你看看程序不就知道了吗
------解决方案--------------------
引用:
引用:不清楚,应该是jsp + html吧,就当jsp页面就可以了,
类似的还有jspf文件等等。。

程序看了,没找到有对应页面。是不是这个"entlogin.jtml"还要经过过滤器什么的?
过滤器只过滤请求,也不可能过滤string(entlogin.jtml)类型的玩意。


if (!bl) {

改成 if (false)

debug看看结果是啥样的。。。