简体   繁体   中英

How to enter more than one value to textarea using jstl

I'm trying to enter multiple values to textarea using JSTL.
Here is my code.

  <label>Resources</label> :
        <c:forEach items="${MEETING_ENTITY}" var="resource">
        <textarea  id="Resources" name="Resources" rows="10" cols="70">
        <c:out value="${resource.resourceEntity.v_resource_name}" ></c:out>
        </textarea>   
        </c:forEach>


When this run few text areas generate as the count of the values. How to set every value using "," to a single text area.
Thank you.

Textarea tag should be before loop -

<label>Resources</label> :
<textarea id="Resources" name="Resources" rows="10" cols="70">
    <c:forEach items="${MEETING_ENTITY}" var="resource">
        <c:out value="${resource.resourceEntity.v_resource_name}" ></c:out> 
    </c:forEach>
</textarea>

After some googling I found the answer.

<label>Resources</label> :
<textarea id="Resources" name="Resources" rows="10" cols="70">
    <c:forEach items="${MEETING_ENTITY}" var="resource" varStatus="loop">
        <c:out value="${resource.resourceEntity.v_resource_name}" ></c:out> 
        <c:if test="${!loop.last}">,</c:if>
    </c:forEach>
</textarea>

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM