Thymeleaf construct URL with variable

后端 未结 5 909
夕颜
夕颜 2020-12-01 01:24

I have the following code setting a variable in my controller:

model.set(\"type\", type);

In the thymeleaf view I want to construct a form

5条回答
  •  情话喂你
    2020-12-01 01:40

    Exception evaluating SpringEL expression: "businessId" (login:50)
    

    I have the same problem and solve via string concatination like below.

    LoginController.java

    @RequestMapping(value = "/login/{businessId}", method = RequestMethod.GET)
        public ModelAndView get(HttpServletRequest request, @PathVariable String businessId) {
            ModelAndView modelAndView = new ModelAndView("login");
            modelAndView.addObject("businessId", businessId);
            return modelAndView;
        }
    

    login.html

                

提交回复
热议问题