I have a JSP file that is

<%@ page import="ChildCare.InvoiceBean" contentType="text/html;charset=ISO-8859-1" %>
<jsp:useBean  id="invoice" class="ChildCare.InvoiceBean" />
<% InvoiceBean[] invoices = (InvoiceBean[])session.getAttribute("invoices"); %>

    <%
    for (int i=0; i< invoices.length; i++) {
       invoice = invoices[i];
    %>

    <jsp:getProperty name="invoice" property="invoiceNumber" />
    <BR>
    <%= invoice.getInvoiceNumber() %>
    <P>

    <%
    }
    %>

</BODY>
</HTML>

My bean code is

package ChildCare;

public class InvoiceBean implements Serializable{
  int invoiceNumber;

  /**
   * Constructor
   */
  public InvoiceBean() {
  }

  public int getInvoiceNumber() {
    return invoiceNumber;
  }

  public void setInvoiceNumber(int newInvoiceNumber) {
    invoiceNumber = newInvoiceNumber;
  }
}

  I get a 0 returned from <jsp:getProperty name="invoice" property="invoiceNumber" />
  and I get the invoice number from <%= invoice.getInvoiceNumber() %>

I am using Tomcat as my servlet container and JSP engine, apache is my web server.

Any idea on why I do not get the invoice number using the getProperty command?

Side note, why do I have to specify my package name (ChildCare) in the useBean command 
since I included it in
my page directive.

Thanks,



Gerry Scheetz
Web Application Development
Global Information Technology Division
TRW - S&ITG
Helena, Montana, USA
[EMAIL PROTECTED]
(406) 594-1878

===========================================================================
To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST".
For digest: mailto [EMAIL PROTECTED] with body: "set JSP-INTEREST DIGEST".
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

Reply via email to