【发布时间】:2014-03-21 15:05:50
【问题描述】:
我会打印第一个链接。但是程序总是打印第二个。
我尝试将!= null 更改为not empty 等,但没有任何变化。
我打印我的对象abstractAttrezzatura.insieme,并且它不为null也不为空,那么为什么这段代码不起作用??
<c:choose>
<c:when test="${abstractAttrezzatura.insieme != null} ">
<a href="${urlInsieme}">${labelInsieme} <img src="${urlTorna}" align="top" height="30" width="30"/></a>
</c:when>
<c:otherwise>
<a href="${urlFoglioLavoro}">${labelFoglioLavoro} <img src="${urlTorna}" align="top" height="30" width="30"/></a>
</c:otherwise>
</c:choose>
控制器:
@RequestMapping(value = "{id}", method = RequestMethod.GET)
public String show(@PathVariable("id") final Long id, final Model uiModel, final Locale locale,
@ModelAttribute("idFoglioLavoro") Long idFoglioLavoro) {
AbstractVerbale verbale = verbaleService.findById(id);
uiModel.addAttribute("verbale", verbale);
uiModel.addAttribute("abstractAttrezzatura", verbale.getAttrezzatura());
uiModel.addAttribute("itemId", verbale.getId());
uiModel.addAttribute("idFoglioLavoro", idFoglioLavoro);
return "verbale/show";
}
【问题讨论】:
-
向我们展示您在请求/会话/servlet/页面上下文中放置和属性名为
abstractAttrezzatura的位置。 -
我不用那个,但我用的是模型
-
向我们展示您如何使用
Model。 -
你能输入什么 .getAttrezzatura() 对象吗?
-
是一个 AbstractAttrezzatura 对象,是我的对象的一个抽象类。