Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9258365
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T12:22:58+00:00 2026-06-18T12:22:58+00:00

I have a String like below: String emps=date1,date2,date3,date4; My requirement is to print like

  • 0

I have a String like below:

String emps=”date1,date2,date3,date4″;

My requirement is to print like below on a jsp page using JSTL tags:

OutPut Should be:

date1

date2

date3

date4

I have used the below code in my jsp:

<c:set var="string2" value="${fn:split(emps,',')}" />
<c:forEach items="${string2}" var="emps1">
<td><c:out value="${emps1}"/></td>

</c:forEach>

But my code is removing “,” this and printing like below in a single line:

date1 date2 date3 date4 

Could any one give me a solution that ,how to print the date values line by line in a jsp using jstl tags?

thanks

Update:

<c:when test="${requestScope.size!=0}">
        <table border="1">
            <tr>
                <th>Employee Code</th>

                <th>EmployeeName</th>
                <th>EmployeeDepartment</th>
                <th>AbsentDate</th>
                <th>TotalNOOfAbsentDates</th>
            </tr>


            <c:forEach items="${requestScope.set1}" var="emps">
                <tr>
                    <td><c:out value="${emps[0]}" /></td>

                    <td><c:out value="${emps[1]}" /></td>
                    <td><c:out value="${emps[2]}" /></td>

                    <td><c:out value="${emps[4]}" /></td>
                    <c:set var="string2" value="${fn:split(emps[3],',')}" />
                    <c:forEach items="${string2}" var="emps1">
                    <td>
                        <p><c:out value="${emps1}"/></p>

                        </td>

                    </c:forEach>

                    </tr>
            </c:forEach>

Note:
I want to print

this(Iteration) data line by line using <td> tag?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-18T12:22:59+00:00Added an answer on June 18, 2026 at 12:22 pm

    Your requirements looks little strange, but if you want to output it with table…

    <table>
        <c:set var="string2" value="${fn:split(emps,',')}" />
        <c:forEach items="${string2}" var="emps1">
            <tr>
                <td><c:out value="${emps1}"/></td>
            </tr>
        </c:forEach>
    </table>
    

    I hope I got your question correctly


    upd:

    Try to run next code:

    <table>
        <c:set var="sourceString" value="${fn:split('q,w,e,r,t,y',',')}" />
        <c:forEach items="${sourceString}" var="element">
            <tr>
                <td><c:out value="${element}"/></td>
            </tr>
        </c:forEach>
    </table> 
    

    It works fine for me (it outputs each letter in new row) and I sure that it would work for you. Check out your html code and try to run this code to be sure, that it works.


    upd2:

    Finally your code would look like this:

    <table border="1">
        <tr>
            <th>Employee Code</th>
    
            <th>EmployeeName</th>
            <th>EmployeeDepartment</th>
            <th>AbsentDate</th>
            <th>TotalNOOfAbsentDates</th>
        </tr>
    
    
        <c:forEach items="${requestScope.set1}" var="emps">
            <tr>
                <c:set var="string2" value="${fn:split(emps[3],',')}" />
                <c:forEach items="${string2}" var="emps1">
    
                    <td><c:out value="${emps[0]}" /></td>
                    <td><c:out value="${emps[1]}" /></td>
                    <td><c:out value="${emps[2]}" /></td>
                    <td><c:out value="${emps1}"/></td>
                    <td><c:out value="${emps[4]}" /></td>
    
                </c:forEach>
            </tr>
        </c:forEach>
    </table>
    

    Your mistake was to mix <tr> tags wits <td>. This code would generate row for each absent date, is it actually what you want?


    upd3:
    If you want to output all this dates in only cell (it looks little ugly), use it:

    <table border="1">
        <tr>
            <th>Employee Code</th>
    
            <th>EmployeeName</th>
            <th>EmployeeDepartment</th>
            <th>AbsentDate</th>
            <th>TotalNOOfAbsentDates</th>
        </tr>
    
    
        <c:forEach items="${requestScope.set1}" var="emps">
            <tr>
                <td><c:out value="${emps[0]}" /></td>
                <td><c:out value="${emps[1]}" /></td>
                <td><c:out value="${emps[2]}" /></td>
                <td>
                    <c:set var="string2" value="${fn:split(emps[3],',')}" />
                    <c:forEach items="${string2}" var="emps1">
                        <p>
                            <c:out value="${emps1}"/>
                        </p>
                    </c:forEach>
                </td>
                <td><c:out value="${emps[4]}" /></td>
            </tr>
        </c:forEach>
    </table>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

i have a string like below $string = ' florida' how can i remove
I have an alphanumeric string like below, $string_1 = a4nas60dj71wiena15sdl1131kg12b and would like to
I have a DataTable MyDT like below: string MyConString = SERVER= + sConfig_hostname +
I have a class like the one below: class Foo { private: std::map<std::string, Bar*>
I have string like \LESSING\root\cimv2:Win32_UserAccount.Domain=LESSING,Name=Admin How to convert it to LESSING\Admin using Framework?
I have string like below: string: //cXML/Request/OrderRequest/ItemOut[]/ItemDetail/Extrinsic[]/home/idea[] if I seperate the string with []
I have a string like below, Hindustan Times, Oct 2009, Review by a well
I set an array which have key in string Like below in my code
Possible Duplicate: convert string to 2D array using php I have the string like
I have a string which I need to pass to a function like below.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.