How to put PrintWriter object content in to table cell

Posted by user3599482 on Stack Overflow See other posts from Stack Overflow or by user3599482
Published on 2014-06-09T09:20:19Z Indexed on 2014/06/09 9:24 UTC
Read the original article Hit count: 217

Filed under:
|
|
|

I have a small problem about a content returning from servlet to put in table cell.

In javascript I am calling servlet method using post, it returns some content and I have to put it in two different <td> cells. here is my code,

In javascript,

$.post('<%=request.getContextPath()%>/controller/UserLockController',{'userName':userName,'status':status},
   function(data)
   {
     document.getElementById("status_"+userName).innerHTML=data;
 document.getElementById("td_"+userName).innerHTML=data;
   });

in servlet it writes as,

out.println("<td id=\"status_"+inputParam+"\">Locked</td>");
out.println("<td id=\"td_"+inputParam+"\"><a href=\"#\" class=\"btn btn-sm btn-primary unlockBtn\" id=\"togBtn_"+inputParam+"\" onClick=\"LockAccount('"+inputParam+"','"+status+"')\">UnLock</td>");

Here content is returning but problem is the both <td> return from servlet will fit in single cell of html table. how to solve this please help me.

© Stack Overflow or respective owner

Related posts about java

Related posts about JavaScript