1

我有 Spring 控制器,在其中我将一些属性映射到模型,然后通过 jsp 页面显示模型信息......问题是所有属性(即${attributeName}- 这是我在渲染页面中得到的)都按定义显示,没有值。到目前为止,这工作得很好。我怀疑其中一个库丢失了,但不知道是哪个库...

提前致谢。

控制器示例

@RequestMapping(value="/entity", method=RequestMethod.GET)
public String getEntity(@RequestParam (value="q", required=true) String q, Model model){
   model.addAttribute("q", q);

   return "viewName"; //this is jsp file name
}

视图名称.jsp

${q}

当我调用 localhost:8080/controller/entity?q=string 时,输出应该是“string”,但输出是 ${q}

4

1 回答 1

0

在您的控制器功能中使用 Model 模型ModelMap map,然后在该映射中添加您的属性。

还要检查你的jsp页面目录的顶部。该标签中是否有任何属性,例如isELIgnored='true',然后将其删除,然后尝试使用它。

我认为它应该可以解决您的问题。

干杯。

于 2012-05-30T10:28:48.253 回答