JSP页面无法识别标签

时间:2012-02-27 19:26:21

标签: jsp spring-mvc

任何人都可以帮助我理解我的jsp页面有什么问题。 'foreach'循环正在运行,但项目的成员不显示(简单文本出现在他们的位置)

    <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);
 }

1 个答案:

答案 0 :(得分:1)

使用

${item.author} 

不是

$(item.author)

EL的语法是${ }而不是$()