【问题标题】:How to create bullet point inside JSTL code如何在 JSTL 代码中创建项目符号点
【发布时间】:2014-06-17 10:23:53
【问题描述】:

我需要在 JSTL 代码中创建 HTML 项目符号文本,例如

段落文本

  • 文本示例 1
  • 文字示例2

我正在使用代码

<div>
     <p>${otherTest}</p>                    
     <c:forEach items="${result}" var="currentItem" varStatus="stat">
    Tips ${stat.index +1 }: ${currentItem}<br> 
    </c:forEach>

</div>

这里的结果包含段落文本和示例文本。我怎样才能做到这一点?

【问题讨论】:

  • 如何在结果中分离段落和示例文本?

标签: html jsp jstl


【解决方案1】:

使用这个

    <c:set var="data"
    value="this is title text\n this is the headigs text: \n 
 this is the tip tesxt1 \n this is the tip text2\nthis is the tip text3"></c:set>
 <c:set var="newline" value="\n" />
<c:set var="dtatPart" value="${fn:split(data, newline)}"></c:set>
<c:set var="limit" value="${fn:length(fn:split(data, newline))}"></c:set>

<p>
    <i>Tip: ${dtatPart[0]}</i>
</p>
<br>
${dtatPart[1]}
<ul>
<c:forEach var="i" begin="2" end="${limit-1}">
        <li>${dtatPart[i]}</li>
</c:forEach>
</ul>

【讨论】:

  • 提示:${dtatPart[0]}


    ${dtatPart[1]}
    • ${dtatPart[i]}
猜你喜欢
  • 1970-01-01
  • 2012-01-24
  • 1970-01-01
  • 2015-05-17
  • 1970-01-01
  • 2020-06-17
  • 2022-01-19
  • 2014-08-09
  • 1970-01-01
相关资源
最近更新 更多