jsp分割字符串并遍历

1、先引入JSTL库

<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>

2、分割字符串并遍历(按“,”分割)

<c:forTokens items="${danger.imagesPath}" delims="," var="file">  
    <li>
        <img src="${path}/${file}">
    </li>
</c:forTokens> 
原文地址:https://www.cnblogs.com/jiefu/p/10907089.html