代码如下:

controller:

@Controller
public class Mv01Controller {
private final Log logger = LogFactory.getLog(Mv01Controller.class);

//处理Head类型的“/”请求
@RequestMapping(value = {"/"}, method = RequestMethod.HEAD)
public String head() {
return "go.jsp";
}

//处理GET类型的“/”和“/index"请求
@RequestMapping(value = {"/index", "/"}, method = RequestMethod.GET)
public String index(Model model) throws Exception {
logger.info("====processed by index");
model.addAttribute("msg", "Go Go Go!");
return "go.jsp";
}
}

jsp使用${msg}接收model中的msg值,通过浏览器打开界面发现直接显示“${msg}”

后来发现原因如下:
在jsp页面使用了el正则表达式,jsp需要配置
<%@page isELIgnored="false" %>
 

相关文章:

  • 2022-12-23
  • 2021-09-28
  • 2021-04-22
  • 2022-12-23
  • 2022-12-23
  • 2023-02-13
  • 2021-08-20
  • 2022-12-23
猜你喜欢
  • 2021-12-18
  • 2021-10-05
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案