0

I have this set of code to display name and status from database:

<table id="gbdb" class="table table-bordered table-striped" style="width:100%">
  <thead>
    <tr>
     <th>Name</th>
     <th>Status</th>
    </tr>
  </thead>
  <tbody>

<c:forEach items="${guestbookList}" var="guestbook">
  <tr>
    <td>${guestbook.name}</td>
    <td>${guestbook.status}</td>
    <!-- ... -->

Right now guestbook.status is returning me either 1 or 0 as stated in the database.

How do I put in an if-else check so that it will display 0 as pending and 1 as approved?

0

1 Answer 1

1

You can try ternary operator ('?')
Syntax :- condition ? exprTrue : exprFalse

 <td> ${guestbook.status == 0 ? 'Pending' : 'Approved'} </td>
Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.