0%

动态定义登陆页

问题

不同用户需要展示不同的登陆页

解决方案

修改web.xml欢迎页,跳转到index.mvc动态页面中

1
2
3
<welcome-file-list>
    <welcome-file>index.mvc</welcome-file>
</welcome-file-list>

创建controller

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
@Slf4j
@Controller
public class IndexController {

/**
* 页面跳转
*
* @return
*/
@RequestMapping(value = "/index", method = RequestMethod.GET)
public String index(@RequestParam Map map, Model model) {
if (map != null) {
model.addAllAttributes(map);
return (String) map.get("custom");
}
return "index";
}
}

效果

http://localhost:8080/hug_interview/?custom=ibd

http://localhost:8080/hug_interview/