jsp页面iterator或forEach循环输出list值

Action中:

   private List<Message> messageList;//省略get,set方法

   @Action("/findAllMessageAOP")
    public String findAllMessageAOP() throws Exception {

        messageList=messageManager.queryAll();
        return "find";//跳转到对应的jsp页面
    }

Jsp页面的显示:

<s:iterator value="messageList">
            <%--用EL表达式直接调用属性循环输出对象的各个属性值--%>

                    <tr>
                        <td>${messageID} </td>
                        <td>${messageSendTime} </td>
                        <td>${messageValidTime}</td>
                        <td>${messageValidTime}</td>
                        <td>${messageContent }</td>
                    </tr>
</s:iterator>



<c:forEach var="message" items="${messageList}">
                 <%--用EL表达式调用list对象的属性循环输出对象的各个属性值--%>

                 <tr>
                    <td>${message.messageID}</td>
                    <td>${message.messageSendTime}</td>
                    <td>${message.messageValidTime}</td>
                    <td>${message.messageValidTime}</td>
                    <td>${message.messageContent}
                    </td>
                  </tr>

</c:forEach>

呈现效果如下:

你可能感兴趣的:(iterator)