java - <c:forEach> not working for to print List of Strings -
hi trying print list of strings stored in arraylist object using jstl, here jsp page:
<%@page import="java.util.arraylist"%> <%@page import="java.util.list"%> <%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>     <%              list<string> al = new arraylist<string>();             al.add("testing1");             al.add("testing2");             al.add("testing3");     al.add("testing4");             al.add("testing5");             system.out.println("hello"+ al);            %>     <c:foreach var="alla" items="${al}" >                <c:out value="hello text"></c:out>                 <c:out value="${alla}"></c:out>             </c:foreach>   when see output not showing thing on browser, have printed using foreach showing result in jstl not printing ?
jstl used print objects session or request scopes. did not set list al either of .
try adding session , access through jstl
httpsession session = request.getsession(); session.setattribute("al", al);   and use c:foreach print in page.
see also
Comments
Post a Comment