Skip to Main Content

Java EE (Java Enterprise Edition) General Discussion

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Show info on JSP without JSTL

511785Dec 9 2007 — edited Dec 11 2007
I have a page that prints out a record using an object that comes from a servlet. I dont have JSTL (due to restrictions in my environment) and need to show the JSP view without JSTL:

Here is the servlet part:
    public void doGet(HttpServletRequest  request,
                      HttpServletResponse response)
                        throws ServletException, IOException{
        
        AddressBook addressBook = new AddressBook();

        List addressRows = addressBook.getAllAddresses();

        request.setAttribute("addressRows", addressRows);

        request.getRequestDispatcher("/WEB-INF/webpage/view.jsp").forward(request, response);
    }
JSP that works with JSTL
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<html>
<body>
        <c:forEach var="row" items="${addressRows}">     
            ${row.firstname}
            ${row.lastname}
        </c:forEach>
</body>
</html>
Now my attempt to show the record without JSTL:
<%@page import="mypackagenamehere.*"%>
<html>
<body>
<%
out.println("Data: " + new AddressBook().addressRows.toString() + " - record info.");
%>
</body>
</html>
This gives me an error:
An error occurred at line: 29 in the jsp file: /WEB-INF/webpage/view.jsp
Generated servlet error:
addressRows cannot be resolved or is not a field


Please advise how I can get this to work without JSTL in my Tomcat 4.1.3 container?
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Jan 8 2008
Added on Dec 9 2007
6 comments
1,353 views