Eugene
Eugene

Reputation: 5543

JSP page don't recognize tags

Can anybody help me to understand, what is wrong with my jsp-page. The 'foreach' loop is working, but the item's members don't display (simple text occurs on their place)

    <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>

The page's controller is the following:

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

Upvotes: 0

Views: 121

Answers (1)

reevesy
reevesy

Reputation: 3472

Use

${item.author} 

not

$(item.author)

The syntax for EL is ${ } not $( )

Upvotes: 1

Related Questions