I have created an jsp page that takes the id from user and in turn calls the servlet in which I am reading the value entered by the user and then passing to my method and that method returns the object and I am storing in a Hashmap as key value pair.
String id = request.getParameter("ManagerId");
//response.getWriter().println(id);
services1 s=new services1();
try {
//s.getList(id);
String name="";
String[] nameArray=new String[10];
System.out.println("id is ===> "+id);
Map<Object, Object> map=messageservice.getReportees(id);
Set s1=map.keySet();
for (Iterator iterator = s1.iterator(); iterator.hasNext();)
{
name = (String) iterator.next();
Collection c=map.values();
String value="";
for (Iterator iterator1 = c.iterator(); iterator.hasNext();)
{
value = (String) iterator1.next(); //error in this line
Map<Object, Object> mapData=jiraservice.getJiras(value);
//System.out.println(value);
System.out.println("returning map");
PrintWriter out=response.getWriter();
out.println("<html><body><table>\r\n" +
"<tr>\r\n" +
"<th>User Id</th>\r\n" +
"<th>Username</th>\r\n" +
"</tr>\r\n" +
"<tr>\r\n" +
"<td>"+value+"</td>\r\n" +
"<td>"+name+"</td>\r\n" +
"</tr>\r\n" +
"</table></body></html>");
}
}
}
Here is the output:
User Id Username
AR12345 Anagha R
User Id Username
MS12345 Anagha R
User Id Username
at12345 Anagha R
User Id Username
AR12345 Madhusudan S
User Id Username
MS12345 Madhusudan S
User Id Username
at12345 Madhusudan S
User Id Username
AR12345 Amreen Taj
User Id Username
MS12345 Amreen Taj
User Id Username
at12345 Amreen Taj
In my output it should print only
User Id Username
AR12345 Amreen Taj
User Id Username
MS12345 Madhusudhan
User Id Username
at12345 Anagha R
I am not getting to know how should this be done.