How to open the desired item in the array

57 views Asked by At

I'm writing a mail module for my application that works with ebay API and I'm trying to open message content in the new jsp page "mail_view.jsp" using jsp session

But when I clicking on the <a> tag I'm always getting the last element from the arraylist.

Where is my mistake?

for (int i = 0; i < mes.length; i++) {
%>
<tr class="unread selected">
  <td>
    <div class="ckbox ckbox-theme">
    <input id="checkbox1" type="checkbox"  checked="checked">
    <label for="checkbox1"></label>
    </div>
  </td>
  <td>
    <a href="" class="star star-checked"  ><i class="fa fa-star"></i></a>
  </td>
  <td>
    <div class="media">
    <a href="mail_view.jsp" onclick= "<%session.setAttribute("message",mes[i].getSubject());%> " class="pull-left">
      <img alt="..." src="../../../assets/global/img/avatar/35/2.png" class="media-object">
    </a>
    <div class="media-body">
      <%if (mes[i].getItemTitle()==null){%>
      <h4 class="text-primary">Ebay</h4><%}
                           else{%>
      <h4 class="text-primary"><%=mes[i].getItemTitle()%></h4><%}%>
      <p class="email-summary"><strong><%=mes[i].getSubject()%></strong> <span class="label label-success">New</span> </p>
      <span class="media-meta"><%=dateTimeFormatter.format(mes[i].getReceiveDate().getTime())%></span>
      <span class="media-attach">
        <%if (mes[i].isReplied()){%>
        <i class="fa fa-share"></i>
        <%}%>
      </span>
    </div>
    </div>
  </td>
</tr>
<%
}%>
0

There are 0 answers