Reputation: 89
I am able to display the table but the headers are bit misaligned and shifted to right. Can someone suggest what can be missing here.
Current o/p: (Header are misaligned)
Server name ID
S1 ABC 43
S2 XYZ 67
Code:
out.append("<table id=\"dtable\" class=\"tablesorter\">");
out.append("<thead>");
out.append("<tr>");
out.append("<th>Server</th>");
out.append("<th>name</th>");
out.append("<th>ID</th>");
out.append("</tr>");
out.append("</thead>");
out.append("<tbody>");
for (String s : returns) {
String[] s2=s.split("-");
out.append("<tr>");
out.append("<td>");
for(String results : s2)
{
out.append(results);
out.append(" ");
}
out.append("</td>");
out.append("</tr>");
}
out.append("</table>");
Upvotes: 2
Views: 257
Reputation: 67505
Try to add every string to separated column td
like :
for (String s : returns) {
String[] s2=s.split("-");
out.append("<tr>");
for(String results : s2)
{
out.append("<td>");
out.append(results);
out.append(" ");
out.append("</td>");
}
out.append("</tr>");
}
Hope this helps.
Upvotes: 1
Reputation: 343
Here your creating a row and closing it “s2” times please check this:
out.append("<tr>");
out.append("<td>");
for (String results : s2) {
out.append(results);
out.append(" ");
}
out.append("</td>");
out.append("</tr>");
}
And there is no tbody close tag
Upvotes: 1