The code I have written in Servlet is as follows:

ArrayList news=admindelegate.getNewsdelegate();//this is defined already
request.setAttribute("news",news);
rd = request.getRequestDispatcher("ViewNews2.jsp");
rd.forward(request,response);

and my JSP code is:

ArrayList newslist=null;
	  ArrayList newslist=(ArrayList)request.getAttribute("news");
	  int newscount= newslist.size();
	  System.out.println("newscount:"+newscount);
	  if(!newslist.isEmpty())
	  {
	  for(int i=0;i<newscount;i++)
	   {
		   %>

	<tr>
	<Td><%=newslist.get(0)%></Td>
                <Td><%=newslist.get(1)%></Td>
	</tr>
        <%
	    }
	  }
	%>

But this table is not displaying the required data.Please help me..

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.