spring mvc jsp界面值渲染不出值
代码如下:
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" %>