0
任何人都可以帮助我理解,我的jsp页面有什么问题。该“的foreach”循环工作,但该项目的成员不显示(在他们的地方出现简单的文本)JSP页面不识别标签
<c:forEach items="${model}" var="item">
<tr>
<td height="10"><hr width="100%" size="2" /></td>
</tr>
<tr>
...
<td width = 10%>
</td>
</tr>
<tr>
<td height="20"><p>Author: $(item.author)</p>
<p>Last updated: $(item.timeLastUpdated)</p>
<p># comments: $(item.commentsCount)</p>
</td>
</tr>
<tr>
<td height="45"><p>$(item.text)</p></td>
</tr>
<tr>
<td height="45"><p><%=item.text%></p></td>
</tr>
</c:forEach>
页的控制器如下:
@RequestMapping(value = "/", method = RequestMethod.GET)
public ModelAndView home(Locale locale, Model model)
{
logger.info("Welcome home! the client locale is "+ locale.toString());
logger.info("Running SIMPLE_BLOG");
Date date = new Date();
DateFormat dateFormat = DateFormat.getDateTimeInstance(DateFormat.LONG, DateFormat.LONG, locale);
String formattedDate = dateFormat.format(date);
model.addAttribute("serverTime", formattedDate);
Iterable<Topic> listTopic = service.findAllTopics();
return new ModelAndView("home", "model", listTopic);
}
谢谢。我的向导有点不正确 – Eugene 2012-02-27 19:34:07
您需要为括号中的所有表达式执行此操作,例如$(item.timeLastUpdated)应该是$ {item.timeLastUpdated} – reevesy 2012-02-27 19:35:41