This week's giveaway is in the Beginning Java forum.
We're giving away four copies of Bad Programming Practices 101 (e-book) and have Karl Beecher on-line!
See this thread for details.
Win a copy of Bad Programming Practices 101 (e-book) this week in the Beginning Java forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

usebean id problem  RSS feed

 
Ranch Hand
Posts: 416
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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?


<HTML>
<HEAD>
<%@ page
language="java"
contentType="text/html; charset=ISO-8859-1"
pageEncoding="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">
<TITLE>Output.jsp</TITLE>
</HEAD>
<BODY>
<%
String invName;
Iterator pAll = ans.iterator();
while(pAll.hasNext()){
invName= (String) pAll.next();
%>
<P>output:<%=invName%><br></P>
<%}%>

</BODY>
</HTML>
 
Author and ninkuma
Marshal
Posts: 66727
167
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You forgot to close your usebean tag.
 
M Burke
Ranch Hand
Posts: 416
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
thanks
 
They gave me pumpkin ice cream. It was not pumpkin pie ice cream. Wiping my tongue on this tiny ad:
Why should you try IntelliJ IDEA ?
https://coderanch.com/wiki/696337/IntelliJ-IDEA
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!