Use JSTL ForTokens to split string : ForTokens « JSTL « Java Tutorial






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

<c:set var="names" value="A:B;C|D" scope="page" />

<html>
  <head>
    <title>forTokens action</title>
  </head>

  <body>
    <c:forTokens items="${pageScope.names}"
                 delims=":;|"
                 var="currentName"
                 varStatus="status"
      >
      Family member #<c:out value="${status.count}" /> is
        <c:out value="${currentName}" /> <br />
    </c:forTokens>
  </body>
</html>
  Download:  JSTLForTokenToSplitString.zip( 1,021 k)








24.6.ForTokens
24.6.1.Use JSTL ForTokens to split string
24.6.2.JSTL ForTokens