Here is my code: 

```
  try {

    String name = "";
    String id1 = empid.getEmpId(id);
    System.out.println("id is ===> " + id1);
    Map < Object, Object > map = reporteeservice.getReportees(id1);
    Set < Map.Entry < Object, Object >> s1 = map.entrySet();
    PrintWriter out1 = response.getWriter();
    out1.println("<html><head><style>\r\n" + "table {\r\n" + "  font-family: arial, sans-serif;\r\n" + "  border-collapse: collapse;\r\n" + "  width: 100%;\r\n" + "}\r\n" + "\r\n" + "td, th {\r\n" + "  border: 1px solid #dddddd;\r\n" + "  text-align: left;\r\n" + "  padding: 4px;\r\n" + "}\r\n" + "\r\n" + "</style>\r\n" +
     "</head><center><font size=\"20\"><body><h2>Reportees List</h2></font>" + "<table>\r\n" + "<tr>\r\n" + "<th>Number</th>" + "<th>User Id</th>" + "<th>Username</th>\r\n</center>" + "<body>");

    for (Iterator < Map.Entry < Object, Object >> iterator = s1.iterator(); iterator.hasNext();) {
     Map.Entry < Object, Object > entry = iterator.next();
     Object name1 = entry.getKey();
     Object value = entry.getValue();
     int num = Number++;

     String values = value.toString();
     //System.out.println("returning map");
     PrintWriter out = response.getWriter();
     System.out.println("values ==> " + values);
     request.setAttribute("empid", values);
     out1.println(

      // "<html><body><table>\r\n" +
      // "<tr>\r\n" +
      // "<th>User Id</th>\r\n" +
      // "<th>Username</th>\r\n" +
      "<table>" + "</tr>\r\n" + "<tr>\r\n" + "<td>" + num + "</td>" + "<td>" + values.toUpperCase() + "</td>" + "<td><a href='./Response1?empidVal=" + values + "'>" + name1 + "</a></td>" + "</tr>\r\n" + "</table></body></html>");

    }

```

Actually I am trying to add the map objects which are dynamic(as they are being iterated over the loop)to html table in an java servlet.
My output is:

```
  Number                           User Id                     Username
   1              AR12355                                Anagha 
   2            MS12345                         Madhusu S
   3             AT12345                          Amreen Tai

```

But I want the output in an aligned manner.
But I am not getting an idea how to append the values to the table.Please help.Thanks in advance