action里面这样写:
[align=left]   List msgList = new LinkedList();
    msgList.add("msg1");
    msgList.add("msg2");
    msgList.add("msg3");
    result_map.put("messages", msgList);
    return new ModelAndView(this.getSuccess_view(), result_map);[/align]jsp里面:
<p>Your current messages:</p>
<c:forEach items="${messages}" var="item" begin="0" end="9" step="1"
varStatus="var">
<c:if test="${var.index % 2 == 0}">
*
</c:if>
${item}<br>
</c:forEach>输出结果是:
Your current messages:
${item}不明白为什么没有结果输出.
ModelAndView(this.getSuccess_view(), result_map) ,这里把result_map设置到哪里去了?request,session?

解决方案 »

  1.   

    result_map.put("messages", msgList); 
    result_map这个是HashMap吗?
    return new ModelAndView(this.getSuccess_view(), result_map);
    你的这个类ModelAndView实现的是什么?
    Action返回的不都是ActionForward对象吗,你们是不是经过了封装的?
      

  2.   

    包装的这么深,先取得外层,然后到messageitems = "${xxx.xxx.message}"
      

  3.   

    action 继承SimpleFormController 
    onSubmit确实是返回ModelAndView,ModelAndView是标准的spring的类,不需要自己实现什么
      

  4.   

    输出的方式应该是<c:out value="${item}"/>
      

  5.   

    多谢大家的回复,不过jsp里面这样写应该是对的
    <p>Your current messages: </p>
    <c:forEach items="${messages}" var="item" begin="0" end="9" step="1"
    varStatus="var">
    <c:if test="${var.index % 2 == 0}">
    *
    </c:if>
    ${item} <br>
    </c:forEach> 现在搞定了,开始问题出在jsp没有支持EL,修改web.xml后就可以了.
    <?xml version="1.0" encoding="UTF-8"?>
    <web-app xmlns="http://java.sun.com/xml/ns/j2ee" 
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
    version="2.4" xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">
    ....