Answer the question
In order to leave comments, you need to log in
How to set a variable in value @RequestMapping in Java Spring?
For example, I have a variable, private String adminPath="admin";
then I write like this
@RequestMapping(value = { "/${adminPath}" }, method = RequestMethod.GET)
public String homeAdmin(ModelMap model) {
model.addAttribute("path", "../templates/home/index");
return "admin/layout/main";
}
Answer the question
In order to leave comments, you need to log in
private static final String ADMIN_PATH = "admin";
@RequestMapping(value = ADMIN_PATH , method = RequestMethod.GET)
public String homeAdmin(ModelMap model) {
model.addAttribute("path", "../templates/home/index");
return "admin/layout/main";
}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question