This week's book giveaway is in the OCAJP 8 forum.
We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line!
See this thread for details.
The moose likes JSP and the fly likes usebean id problem Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of OCA Java SE 8 Programmer I Study Guide this week in the OCAJP 8 forum!
JavaRanch » Java Forums » Java » JSP
Bookmark "usebean id problem" Watch "usebean id problem" New topic

usebean id problem

M Burke
Ranch Hand

Joined: Jun 25, 2004
Posts: 396
I bind an ArrayList called ans into the request in a servlet....

req.setAttribute("ans", ejbClient.getAns());
RequestDispatcher rd = req.getRequestDispatcher("/Output");
rd.forward(req, resp);

Then in Output.jps I try to access it using usebean. But I get an error in the scriptlet "ans cannot be resolved" at line "Iterator pAll = ans.iterator();"

What am I missing here?

<%@ page
contentType="text/html; charset=ISO-8859-1"
<%@ page import="java.util.*" %>
<jsp:usebean id="ans" class="java.util.ArrayList" scope="request">

<META http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<META name="GENERATOR" content="IBM WebSphere Studio">
String invName;
Iterator pAll = ans.iterator();
invName= (String);

Bear Bibeault
Author and ninkuma

Joined: Jan 10, 2002
Posts: 63352

You forgot to close your usebean tag.

[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
M Burke
Ranch Hand

Joined: Jun 25, 2004
Posts: 396
I agree. Here's the link:
subject: usebean id problem
It's not a secret anymore!