Hai,
I worked a example in HFSJ.
servlet program:
package com.example.web;
import javax.servlet.*;
import javax.servlet.http.*;
import java.io.*;
import java.util.*;
public class Movie extends HttpServlet
{
public void doGet(HttpServletRequest request,HttpServletResponse response)throws ServletException,IOException
{
response.setContentType("text/html");
PrintWriter out=response.getWriter();
String movielist1[]={"amelie","return of the king"};
ArrayList AL=new ArrayList();
AL.add(movielist1);
request.setAttribute("moviename",AL);
RequestDispatcher view=request.getRequestDispatcher("output2.jsp");
view.forward(request,response);
}
}
JSTL coding:
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<html>
<strong>Movie List</strong>
<table>
<c:forEach var="movie1" items="${moviename}">
<tr>
<td>${movie1}</td>
</tr>
</c:forEach>
</table>
</html>
In the book the output is given:
amelie
return of the king
but i got the output the object of the ArrayList.
what is the wrong in the coding?
plz explain.
regards,
P.Ramu