json中物件陣列迭代

庸醫2048發表於2016-05-12

{"id":null,"type":null,"state":1,"submitTime":null,"verifyRemark":null,"verifyTime":null,"createId":"1","createTime":1461996015000,"lastModifyId":null,
"lastModifyTime":null,"title":"去大理","brief":"要寫一篇攻略 首先會寫字。。。","materials":{"title":"工具","list":["電腦 一臺","寶迪賬號一個"]},
"notices":{"title":"注意事項","list":["ffff"]},"stepList":[{"title":"步驟","list":[{"cotent":"開啟電腦。。。",
"piclst":[]},{"cotent":"開啟電腦2。。。","piclst":["http://images.haiwainet.cn/2016/0512/20160512083447501.jpg","圖片地址1"]},
{"cotent":"開啟電腦1。。。","piclst":[]}]}]}

解決方式:使用了c:set  c:foreach

<div class="preview-block">
            <h2 class="pre-h2">${data.materials.title} </h2>
            <ul class="exp-content-list">
                ${data.materials.list[0]}
                ${data.materials.list.size()}
                <c:set var="index" value="0" /> 
                <c:forEach begin="0" end="${data.materials.list.size()}" step="1" >
                    <li class="list-item-1">
                    <div class="pre-text"><P>${data.materials.list[index]}</P></div>
                    </li>
                    <c:set var="index" value="${index+1}" />
                </c:forEach>
            </ul>
        </div>






http://note.youdao.com/yws/public/redirect/share?id=c33a34c6ac288c1f59d6603b0280d2e4&type=false

相關文章