kamweshi 0 Newbie Poster

I am trying to display a list of vehicles in jsp with properies from (vehicle bean and customer bean).the properties from the vehicle beans are displaying, but the Name and Address from the customer bean are not displaying.Can you please look at my code and see where i am going wrong?

<%@page contentType="text/html" pageEncoding="UTF-8"%>

<jsp:useBean id="Vehicle" class="beans.Vehicle" scope="request" />
<jsp:useBean id="Customer" class="beans.Customer" scope="request" />
<%@page import="java.util.*,java.sql.*,java.lang.*,javax.servlet.http.*" %>
<% java.util.Vector vehicleList =(java.util.Vector)request.getAttribute ("vehicleList");

if (vehicleList != null)
    {
    int ctr = 0;
    %>
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <title>Week 06, Portfolio Exercise</title>
        <link rel="stylesheet" type="text/css" href="Week06_Portfolio.css" />
   </head>
    <body>
        <h1>Week 06, Portfolio Exercise</h1>

        <h2>All Vehicles</h2>

        <table class="vehicleList">
            <tr>
                <td><b>Id</b></td>
                <td><b>Reg.Mark</b></td>
                <td><b>Type</b></td>
                <td><b>Colour</b></td>
                <td><b>Name</b></td>
                <td><b>Address</b></td>
            </tr>
       <%              if (vehicleList.size() == 0)
                {
    %>         
    <%
    }
       else
           {
           for (int i=0; i<vehicleList.size(); i++)

               {
               beans.Vehicle veh =(beans.Vehicle)vehicleList.elementAt(i);
               
        
        %>

       <tr<%= ctr++ % 2 == 0 ? " class=\"shaded\"" : ""%>>
                       <td><%=veh.getId()%></td>
                       <td><%=veh.getRegistrationMark()%></td>
                       <td><%=veh.getTypeOfVehicle()%></td>
                       <td><%=veh.getColour()%></td>
                       <td><%=Customer.getName()%></td>
                       <td><%=Customer.getAddress()%></td>
        </tr>
        <% }
           }
       %>
        </table>
    </body>
</html>
<% } %>
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.