Just a brief look at it brings up a question:
Shouldn't you declare acctArray as array?
AccountBean[] acctArray = (AccountBean[])
request.getAttribute("accounts");
Shane Duan
[EMAIL PROTECTED]
-----Original Message-----
From: Enriqueta Tuason [mailto:[EMAIL PROTECTED]]
Sent: Friday, July 07, 2000 6:08 PM
To: [EMAIL PROTECTED]
Subject: problem passing Array from Servlet to JSP (newbie
question)
Hi,
I'm trying to pass an Array from a Servlet to JSP. My problem is that
all of the values that show up on the JSP are zero, but I get the
correct length of the size of the Array.
Here's what I have
in the Servlet:
-----------------
AccountBean[] aB = getAccounts();
req.setAttribute("accounts",aB);
in the JSP:
-------------
<jsp:useBean id="acct" class="AccountBean" scope="request"/>
<%
AccountBean acctArray = (AccountBean[])
request.getAttribute("accounts");
%>
Length-<% =acctArray.length%>
<br>
<%
for (int i=0; i < acctArray.length; i++)
{
acct = acctArray[i];
%>
<br>id- <jsp:getProperty name="acct" property="ID"/>
<br>name-<jsp:getProperty name="acct" property="name"/>
<br>percentage- <jsp:getProperty name="acct" property="percent"/>
<% } %>
Result (displayed in browser)(if I have 2 accounts in the array)
---------
Length-2
0
0.0
0
0.0
I also tried using vectors, but I get the same result.
Does anyone have any ideas? I have been stuck on this for a while now,
and can't figure it out.
Thanks so much,
Enriqueta
------- End of forwarded message -------
_____________________________________________________________
GoSharks Email - Official Email of the San Jose Sharks
Get your free GoSharks email account: http://www.sjsharks.com
ifan Sports Fan Email - http://www.ifan.com
========================================================================
===
To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff
JSP-INTEREST".
Some relevant FAQs on JSP/Servlets can be found at:
http://java.sun.com/products/jsp/faq.html
http://www.esperanto.org.nz/jsp/jspfaq.html
http://www.jguru.com/jguru/faq/faqpage.jsp?name=JSP
http://www.jguru.com/jguru/faq/faqpage.jsp?name=Servlets
===========================================================================
To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST".
Some relevant FAQs on JSP/Servlets can be found at:
http://java.sun.com/products/jsp/faq.html
http://www.esperanto.org.nz/jsp/jspfaq.html
http://www.jguru.com/jguru/faq/faqpage.jsp?name=JSP
http://www.jguru.com/jguru/faq/faqpage.jsp?name=Servlets