iterate over the properties of an object in JSTL, not an array list or collection

StackOverflow https://stackoverflow.com/questions/22738409

  •  23-06-2023
  •  | 
  •  

سؤال

I have a person object and was wondering if I can use JSTL to do something like this:

                        <c:forEach items="${user}" var="element"> 
                      <tr>
                        <td>${element.firstname}</td>
                        <td>${element.lastname}</td>
                        <td>${element.age}
                      </tr>
                    </c:forEach> 

everything I've found so far points to collections or an array list. user is stored as a session variable.

Is this possible?
Many thanks.

هل كانت مفيدة؟

المحلول

no its not possible to iterate an user object. you can iterate only collections. because it is a single object .

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top