Bishwa Karki Bishwa Karki - 1 year ago 59
Java Question

How to display data inline?

I hava a

play.jsp
and I wanted to display the data in a formatted way like the question id and question in a single line and answer in next single line. How can I do that? I would be very thankful for the answers.

<div class="container">
<table class="table">
<center>
<p>Question</p>
<c:forEach items="${quiz}" var="qz">
<p> ${qz.id}</p>
<p>${qz.question}</p>
<p>${qz.ans1}</p>
<p> ${qz.ans2} </p>
<p>${qz.ans3} </p>
</c:forEach>

</center>
</table>
</div>


Now I am getting output in this way
Now I am getting output in this way

Answer Source

Just put them in the same <p></p> like <p>${qz.id} ${qz.question}</p>

<div class="container">
  <table class="table">
    <center>
      <p>Question</p>
      <c:forEach items="${quiz}" var="qz">
        <p>${qz.id} ${qz.question}</p>
        <p>${qz.ans1}</p>
        <p> ${qz.ans2} </p>
        <p>${qz.ans3} </p>
      </c:forEach>

    </center>
  </table>
</div>

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download