Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
165
Multiple Editable Grids on the same page problem with Duplicate componentIDs
posted

  Normal 0 false false false MicrosoftInternetExplorer4 /* Style Definitions */ table.MsoNormalTable {mso-style-name:"Table Normal"; mso-tstyle-rowband-size:0; mso-tstyle-colband-size:0; mso-style-noshow:yes; mso-style-parent:""; mso-padding-alt:0in 5.4pt 0in 5.4pt; mso-para-margin:0in; mso-para-margin-bottom:.0001pt; mso-pagination:widow-orphan; font-size:10.0pt; font-family:"Times New Roman"; mso-ansi-language:#0400; mso-fareast-language:#0400; mso-bidi-language:#0400;}

Hello all,

 

   This is my first post so please be gentle.  What I'm trying to do is have a page with two tabs items and within each tab is an editable grid.  The JSP is below.   I get

org.apache.jasper.JasperException: javax.servlet.ServletException: javax.servlet.jsp.JspException: java.lang.IllegalStateException: Duplicate component ID '_id0:dataTabs:dataTwoGV:ge2

 found in view. org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:522) org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:398) org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:342) org.apache.jasper.servlet.JspServlet.service(JspServlet.java:267) javax.servlet.http.HttpServlet.service(HttpServlet.java:717) com.sun.faces.context.ExternalContextImpl.dispatch(ExternalContextImpl.java:322)

etc....

  even though I was careful to make sure each of the components have  a uniqe ID.  Could it be that I need multiple <f:view> tags???  I'm new to the JSF and Infragistics arena.

 

Thanks in advance!!!

 

Eric Bieche

Senior Programmer

Nielsen

eric.bieche@nielsen.com

 

<%@ taglib uri="http://java.sun.com/jsf/html" prefix="h" %>

<%@ taglib uri="http://java.sun.com/jsf/core" prefix="f" %>

<%@ taglib uri="http://es.infragistics.com/faces/netadvantage" prefix="ig" %>

<%@ page language="java"

         contentType="text/html; charset=ISO-8859-1"

         pageEncoding="ISO-8859-1" %>

 

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">

<html>

<head>

   <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">

   <link rel='stylesheet' type='text/css' href='style2.css' />

   <title>ABS Penetration Model</title>

</head>

<body><f:view><h:form>

   <span class='heading'>ABS Penetration Model</span>

   <br/>

   <ig:tabView id="dataTabs" >

      <ig:tabItem value="Look at Data1">

         <ig:gridView id="dataOneGV"

                      allowFixedColumns="true"

                      rowFetchSize="300"

                      loadOnDemand="default"

                      columnStyleClass="font-style: normal; font-family: Arial, Verdana, Sans-Serif;"

                      style="height: 200px; width: 100%; font-style: normal; font-family: Arial, Verdana, Sans-Serif; font-weight: bold;"

                      binding="#{webgrid_dynamicGridPage.grid1}"

                      dataSource="#{webgrid_dynamicGridPage.data1}" >

 

            <ig:gridEditing id="ge1"

                            enableOnMouseClick="single"

                            cellValueChangeListener="#{webgrid_dynamicGridPage.cellValueChangeListener}" />

 

            <ig:gridActivation id="ga1" />

 

            <f:facet name="header"> <h:outputText value="The Data One" /> </f:facet>

           

            <ig:column style="width:30px" readOnly="true">

               <f:facet name="header"> <h:outputText value="DMA" /> </f:facet>

               <h:outputText value="#{DATA_ROW.dmaCode}" />

            </ig:column>

 

<%-- More columns here --%>

 

            <ig:column style="width:30px">

               <f:facet name="header"> <h:outputText value="Factor" /> </f:facet>

               <f:facet name="editor">

                  <h:inputText value="#{DATA_ROW.factor}"

                               styleClass="igGridCellEdit"

                               style="width:30px;height:11px" />

               </f:facet>

               <h:outputText value="#{DATA_ROW.factor}" />

            </ig:column>

         </ig:gridView>

      </ig:tabItem>

      <ig:tabItem value="Look at Data2">

         <ig:gridView id="dataTwoGV"

                      allowFixedColumns="true"

                      rowFetchSize="300"

                      loadOnDemand="default"

                      columnStyleClass="font-style: normal; font-family: Arial, Verdana, Sans-Serif;"

                      style="height: 200px; width: 100%; font-style: normal; font-family: Arial, Verdana, Sans-Serif; font-weight: bold;"

                      binding="#{webgrid_dynamicGridPage.grid2}"

                      dataSource="#{webgrid_dynamicGridPage.data2}" >

 

            <ig:gridEditing id="ge2"

                            enableOnMouseClick="single"

                            cellValueChangeListener="#{webgrid_dynamicGridPage.cellValueChangeListener}" />

 

            <ig:gridActivation id="ga2" />

 

            <f:facet name="header"> <h:outputText value="The Data Two" /> </f:facet>

 

            <ig:column style="width:30px" readOnly="true">

               <f:facet name="header"> <h:outputText value="DMA" /> </f:facet>

               <h:outputText value="#{DATA_ROW.dmaCode}" />

            </ig:column>

 

<%-- More columns here --%>

 

            <ig:column style="width:30px">

               <f:facet name="header"> <h:outputText value="Factor" /> </f:facet>

               <f:facet name="editor">

                  <h:inputText value="#{DATA_ROW.factor}"

                               styleClass="igGridCellEdit"

                               style="width:30px;height:11px" />

               </f:facet>

               <h:outputText value="#{DATA_ROW.factor}" />

            </ig:column>

         </ig:gridView>

      </ig:tabItem>

</ig:tabView>

 

</h:form></f:view></body>

</html>

  • 1765
    posted

    Hi Eric,

    I tested your jsp code and looks like it works perfectly fine. Attached is the updated jsp and backing bean. Greatly appreciate if you could cross check the jsp file for any duplicate id's. This may be the only reason for such a exception thrown.

    Thank you!

    gridInTabView.jsp

    <%@ taglib uri="http://java.sun.com/jsf/html" prefix="h"%>

    <%@ taglib uri="http://java.sun.com/jsf/core" prefix="f"%>

    <%@ taglib uri="http://es.infragistics.com/faces/netadvantage" prefix="ig"%> <%@ page language="java" contentType="text/html; charset=ISO-8859-1"

    pageEncoding="ISO-8859-1"%>

     

    <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">

     

    <html>

    <head>

    <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">

    <link rel='stylesheet' type='text/css' href='style2.css' />

    <title>ABS Penetration Model</title>

    </head>

    <body>

    <f:view>

    <h:form>

    <span class='heading'>ABS Penetration Model</span>

    <br />

    <ig:tabView id="dataTabs">

    <ig:tabItem value="Look at Data1">

    <ig:gridView id="dataOneGV" allowFixedColumns="true"

    rowFetchSize="300" loadOnDemand="default"

    columnStyleClass="font-style: normal; font-family: Arial, Verdana, Sans-Serif;" style="height: 200px; width: 100%; font-style: normal; font-family: Arial, Verdana, Sans-Serif; font-weight: bold;"

    binding="#{webgrid_gridPage.grid}"

    dataSource="#{webgrid_gridPage.employees}">

    <ig:gridEditing id="ge1" enableOnMouseClick="single"

    cellValueChangeListener="#{webgrid_gridPage.cellValueChangeListener}" />

    <ig:gridActivation id="ga1" />

    <f:facet name="header">

    <h:outputText value="The Data One" />

    </f:facet>

    <ig:column style="width:30px" readOnly="true">

    <f:facet name="header">

    <h:outputText value="firstName" />

    </f:facet>

    <h:outputText value="#{DATA_ROW.firstName}" />

    </ig:column>

    <%-- More columns here --%>

    <ig:column style="width:30px">

    <f:facet name="header">

    <h:outputText value="lastName" />

    </f:facet>

    <f:facet name="editor">

    <h:inputText value="#{DATA_ROW.lastName}"

    styleClass="igGridCellEdit" style="width:30px;height:11px" />

    </f:facet>

    <h:outputText value="#{DATA_ROW.lastName}" />

    </ig:column>

    </ig:gridView>

    </ig:tabItem>

    <ig:tabItem value="Look at Data2">

    <ig:gridView id="dataTwoGV" allowFixedColumns="true"

    rowFetchSize="300" loadOnDemand="default"

    columnStyleClass="font-style: normal; font-family: Arial, Verdana, Sans-Serif;" style="height: 200px; width: 100%; font-style: normal; font-family: Arial, Verdana, Sans-Serif; font-weight: bold;"

    binding="#{webgrid_gridPage.grid1}"

    dataSource="#{webgrid_gridPage.employees2}">

    <ig:gridEditing id="ge2" enableOnMouseClick="single"

    cellValueChangeListener="#{webgrid_gridPage.cellValueChangeListener}" />

    <ig:gridActivation id="ga2" />

    <f:facet name="header">

    <h:outputText value="The Data Two" />

    </f:facet>

    <ig:column style="width:30px" readOnly="true">

    <f:facet name="header">

    <h:outputText value="firstName" />

    </f:facet>

    <h:outputText value="#{DATA_ROW.firstName}" />

    </ig:column>

    <%-- More columns here --%>

    <ig:column style="width:30px">

    <f:facet name="header">

    <h:outputText value="lastName" />

    </f:facet>

    <f:facet name="editor">

    <h:inputText value="#{DATA_ROW.lastName}"

    styleClass="igGridCellEdit" style="width:30px;height:11px" />

    </f:facet>

    <h:outputText value="#{DATA_ROW.lastName}" />

    </ig:column>

    </ig:gridView>

    </ig:tabItem>

    </ig:tabView>

     

    </h:form>

    </f:view>

    </body>

    </html>

    BaseGridPage.java

    package com.infragistics.grid.shared;

     

    import java.util.List;

     

    import javax.faces.event.ValueChangeEvent;

     

    import com.infragistics.faces.grid.component.GridView;

    import com.infragistics.grid.dao.DAO;

    import com.infragistics.faces.shared.event.SortEvent;

     

    public class BaseGridPage {

     

    protected GridView grid = null;

    protected GridView grid1 = null;

    private boolean readOnly = true;

     

     

    List
    companies = DAO.getCompanies();List employees = DAO.getEmployees();

     

    public List getCompanies() {

    return companies;

    }

     

    public List getEmployees() {return employees;

    }

     

    public List getEmployees2() {return employees;

    }

     

    public void sortListener(SortEvent evnt) {System.out.println("A SortEvent has been fired");

    }

     

    /**

    * @return Returns the grid.

    */

    public GridView getGrid() {return grid;

    }

     

    /**

    * @param grid The grid to set.

    */

    public void setGrid(GridView grid) {this.grid = grid;

    }

     

    public GridView getGrid1() {return grid1;

    }

     

    public void setGrid1(GridView grid1) {this.grid1 = grid1;

    }

     

     

    public String gridStyle() {

     

    return "width: 50px";

     

    }

     

    public boolean isReadOnly() {return readOnly;

    }

     

    public void setReadOnly(boolean readOnly) {this.readOnly = readOnly;

    }

     

    public void cellValueChangeListener(ValueChangeEvent evnt){System.out.println("cellValueChangeListener method called:");

    }

     

    }

    DAO.java

    package com.infragistics.grid.dao;

    import java.beans.BeanInfo;
    import java.util.ArrayList;
    import java.util.Calendar;
    import java.util.Date;
    import java.util.HashMap;
    import java.util.Iterator;
    import java.util.List;
    import java.util.Map;

    import com.infragistics.grid.databean.Company;
    import com.infragistics.grid.databean.DataSource;
    import com.infragistics.grid.databean.Person;

    /**
     * Employee DAO class
     *
     * @author stephane
     *
     */
    public class DAO {

     private static List cachedCompanies = null;
     private static Map cachedEmployees = null;

     private Date hireDate = null;
     private boolean married = false;
     private int age = -1;
     
     private static String managers[[ = {
      { "Wintheiser", "Marc", "1Aaaaa.R.Wintheiser@TinyAnyTime.netsdfasd",
       "309-4605", "GBR", "London", "1992-10-22", "false", "21" },
     { "Dickinson", "Tate", "Tate.L.Dickinson@TinyCentre.net",
       "381-0385", "GBR", "London", "1992-10-22", "true", "20" },
     { "Hoppe", "Estel", "Estel.D.Hoppe@SplatTel.edu", "697-6184",
       "GBR", "London", "1992-10-22", "true", "21" },
     { "Wiza", "Cleta", "Cleta.T.Wiza@AshOnLine.edu", "383-7294", "GBR",
       "London", "1992-10-22", "true", "21" },
     { "Olson", "Nathanael", "Nathanael.R.Olson@PipeOffLine.net",
       "564-5693", "GBR", "London", "1992-10-22", "true", "21" }  
     };

     private static String employees[[ = {
       // Australlia - Canberra
       { "Boylevwer", "Allene", "1Allene.J.Boyle@InfoHQ.edu", "768-4994",
         "AUS", "Canberra", "2002-10-22", "false", "30" },
       { "Rolfson", "Karine", "Karine.W.Rolfson@Funnet.com", "663-6448",
         "AUS", "Canberra", "1992-10-22", "false", "20" },
       { "Roberts", "Blaise", "Blaise.C.Roberts@FoobarTel.net",
         "037-9519", "AUS", "Canberra", "1995-10-22", "false", "23" },
       { "Okuneva", "Anaya", "Anaya.I.Okuneva@Oneweb.co.uk", "695-8691",
         "AUS", "Canberra", "1992-10-28", "true", "23" },
       { "Kris", "Tristin", "Tristin.Y.Kris@Spiderex.edu", "167-5832",
         "AUS", "Canberra", "1992-10-22", "true", "25" },
       { "Thompson", "Jasmine", "Jasmine.I.Thompson@RedTrunk.edu",
         "756-7221", "AUS", "Canberra", "1996-10-22", "false", "36" },
       { "Powlowski", "Otis", "Otis.A.Powlowski@MultiHQ.co.uk",
         "763-7185", "AUS", "Canberra", "2007-10-22", "true", "21" },
       { "Simonis", "Maiya", "Maiya.K.Simonis@FunServe.com", "638-8493",
         "AUS", "Canberra", "1992-10-22", "true", "21" },
       { "Murazik", "Jazmin", "Jazmin.W.Murazik@FastTel.co.uk",
         "432-1236", "AUS", "Canberra", "1992-10-22", "true", "21" },
       // Australlia - Sydney
       { "Braun", "Ruth", "Ruth.M.Braun@NetOnLine.co.uk", "101-4264",
         "AUS", "Sydney", "1996-01-22", "true", "23" },
       { "Homenick", "Lelah", "Lelah.U.Homenick@WowTrunk.com", "452-5089",
         "AUS", "Sydney", "1995-10-22", "true", "29" },
       { "Green", "Jamaal", "Jamaal.R.Green@NetConnection.com",
         "220-8726", "AUS", "Sydney", "1996-10-22", "false", "27" },
       { "Lowe", "Janessa", "Janessa.C.Lowe@Simpleworld.co.uk",
         "090-8318", "AUS", "Sydney", "1999-10-22", "true", "27" },
       { "Steuber", "Devin", "Devin.L.Steuber@ClearWire.net", "600-0286",
         "AUS", "Sydney", "1997-11-26", "true", "21" },
       { "Ondricka", "Fiona", "Fiona.H.Ondricka@CowboyServe.com",
         "351-8596", "AUS", "Sydney", "1992-10-22", "true", "29" },
       // United Kingdom - Bristol
       { "Hyatt", "Elmo", "Elmo.V.Hyatt@GoodOnLine.com", "178-0434",
         "GBR", "Bristol", "1992-10-22", "true", "21" },
       { "Ankunding", "Gardner", "Gardner.G.Ankunding@BTCentre.com",
         "145-9627", "GBR", "Bristol", "1999-10-22", "true", "21" },
       { "Dicki", "Modesta", "Modesta.Y.Dicki@EasyUsers.com", "003-4060",
         "GBR", "Bristol", "1996-10-22", "false", "21" },
       { "Burke", "Matt", "Matt.U.Burke@CoolConnection.com", "466-0502",
         "GBR", "Bristol", "1992-10-22", "true", "34" },
       { "Jacobi", "Janick", "Janick.V.Jacobi@WowTrunk.edu", "352-1810",
         "GBR", "Bristol", "1995-10-28", "false", "21" },
       { "Cummings", "Harvey", "Harvey.E.Cummings@FastPlugs.edu",
         "023-2126", "GBR", "Bristol", "1999-10-12", "true", "21" },
       { "Swaniawski", "Delmer",
         "Delmer.N.Swaniawski@SplendidOffLine.net", "960-8029",
         "GBR", "Bristol", "1992-10-22", "true", "34" },
       { "Mante", "Eugenie", "Eugenie.K.Mante@EasyCall.com", "080-1354",
         "GBR", "Bristol", "1992-10-22", "true", "21" },
       // United Kingdom - London
       { "Block", "Paola", "Paola.L.Block@NTLHQ.edu", "022-4214", "GBR",
         "London", "1992-10-22", "true", "21" },
       { "DuBuque", "Alta", "Alta.D.DuBuque@Nice4U.co.uk", "258-6027",
         "GBR", "London", "1992-10-22", "true", "21" },
       { "Kihn", "Kendall", "Kendall.Y.Kihn@RedWire.com", "654-8785",
         "GBR", "London", "1992-10-22", "true", "21" },
       { "Daniel", "Royal", "Royal.V.Daniel@Uniex.com", "925-4446", "GBR",
         "London", "1992-10-22", "true", "21" },
       { "Dickens", "Madalyn", "Madalyn.N.Dickens@OneMail.com",
         "492-9069", "GBR", "London", "1992-10-22", "true", "21" },
       { "Davis", "Wilson", "Wilson.L.Davis@CrazyConnection.edu",
         "929-6726", "GBR", "London", "1992-10-22", "true", "21" },
       { "Wintheiser", "Marc", "Marc.R.Wintheiser@TinyAnyTime.net",
         "309-4605", "GBR", "London", "1992-10-22", "false", "21" },
       { "Dickinson", "Tate", "Tate.L.Dickinson@TinyCentre.net",
         "381-0385", "GBR", "London", "1992-10-22", "true", "20" },
       { "Hoppe", "Estel", "Estel.D.Hoppe@SplatTel.edu", "697-6184",
         "GBR", "London", "1992-10-22", "true", "21" },
       { "Wiza", "Cleta", "Cleta.T.Wiza@AshOnLine.edu", "383-7294", "GBR",
         "London", "1992-10-22", "true", "21" },
       { "Olson", "Nathanael", "Nathanael.R.Olson@PipeOffLine.net",
         "564-5693", "GBR", "London", "1992-10-22", "true", "21" },
       // United States - Chicago
       { "Rath", "Burl", "Burl.I.Rath@DirectWire.edu", "419-4773", "USA",
         "Chicago", "1992-10-22", "true", "21" },
       { "Will", "Jaclyn", "Jaclyn.U.Will@CowWire.edu", "725-5863", "USA",
         "Chicago", "1992-10-22", "true", "21" },
       { "Larson", "Wilburn", "Wilburn.T.Larson@ApexEast.net", "549-8099",
         "USA", "Chicago", "1992-10-22", "true", "20" },
       { "Lindgren", "Gerhard", "Gerhard.D.Lindgren@AcmeHelpLine.co.uk",
         "453-0723", "USA", "Chicago", "1992-10-22", "true", "21" },
       { "Smitham", "Danielle", "Danielle.G.Smitham@CheerfulHQ.edu",
         "751-3457", "USA", "Chicago", "1992-10-22", "true", "21" },
       { "Luettgen", "Emery", "Emery.A.Luettgen@SpiderOffLine.edu",
         "189-9906", "USA", "Chicago", "1992-10-22", "false", "21" },
       { "Butterworth", "Ollie", "Ollie.T.Butterworth@MultiCentre.edu",
         "590-4832", "USA", "Chicago", "1992-10-22", "true", "21" },
       { "Ratke", "Ericka", "Ericka.N.Ratke@Whizzoex.edu", "251-3796",
         "USA", "Chicago", "1992-10-22", "true", "21" },
       { "Glover", "Annamarie", "Annamarie.N.Glover@PowerInternet.com",
         "170-7472", "USA", "Chicago", "1992-10-22", "true", "24" },
       // United States - San Francisco
       { "Parisian", "Geo", "Geo.B.Parisian@PinnacleTel.com", "131-9440",
         "USA", "San Francisco", "1992-10-22", "true", "21" },
       { "Parker", "Dexter", "Dexter.H.Parker@ZapEast.co.uk", "348-3665",
         "USA", "San Francisco", "1992-10-22", "true", "21" },
       { "Pollich", "Franco", "Franco.E.Pollich@AmazeEast.edu",
         "249-3494", "USA", "San Francisco", "1992-10-22", "true",
         "21" },
       { "Cummings", "Signe", "Signe.P.Cummings@SimpleInternet.edu",
         "826-4923", "USA", "San Francisco", "1992-10-22", "true",
         "21" },
       { "Friesen", "Alexandre", "Alexandre.K.Friesen@AOLTrunk.com",
         "394-7213", "USA", "San Francisco", "1992-10-22", "true",
         "34" },
       { "Leffler", "Eloise", "Eloise.M.Leffler@QuickEast.co.uk",
         "093-6603", "USA", "San Francisco", "1992-10-22", "true",
         "21" },
       { "Gibson", "Dakota", "Dakota.B.Gibson@Funex.edu", "144-5563",
         "USA", "San Francisco", "1992-10-22", "false", "21" },
       { "Wiza", "Lula", "Lula.B.Wiza@SplatTel.edu", "714-1404", "USA",
         "San Francisco", "1992-10-22", "true", "21" },
       { "Hilll", "Enoch", "Enoch.D.Hilll@Spiffingnet.com", "377-2802",
         "USA", "San Francisco", "1992-10-22", "false", "21" },
       { "Wilderman", "Remington", "Remington.Y.Wilderman@AshAnyTime.com",
         "567-4907", "USA", "San Francisco", "1992-10-22", "true",
         "21" },
       { "Von", "Elroy", "Elroy.U.Von@Goodnet.net", "981-5743", "USA",
         "San Francisco", "1992-10-22", "true", "21" },
       { "Emmerich", "Signe", "Signe.Y.Emmerich@Flippityworld.co.uk",
         "297-6853", "USA", "San Francisco", "1992-10-22", "true",
         "21" },
       { "Turner", "Charlie", "Charlie.C.Turner@QuickServe.net",
         "524-2264", "USA", "San Francisco", "1992-10-22", "true",
         "25" },
       { "Hirthe", "Cary", "Cary.E.Hirthe@NiceTrunk.com", "363-7814",
         "USA", "San Francisco", "1992-10-22", "true", "21" } };

     private static String companies[[ = { { "ACME", "AUS", "Canberra" },
       { "Infragistics", "USA", "East Windsor" },
       { "Fun", "USA", "Fun city" }, { "Doll", "UK", "London" },
       { "Mucrosoft", "UK", "Bristol" }, { "Compiq", "AUS", "Sydney" },
       { "Acrobot", "AUS", "Canberra" },
       { "Ebal", "USA", "San Francisco" }, { "Gookle", "UK", "London" },
       { "IBN", "USA", "Santa cruz" } };

     public static DataSource getDataSourceCompanies() {
      return new DataSource(Company.getMetaData(), getCompanies());
     }

     public static DataSource getDataSourceEmployees() {
      return new DataSource(Person.getMetaData(), getEmployees());
     }

     public static List getCompanies() {
      //Rebuild every time because we don't want anybody to edit the companies in the demo site
      //if (cachedCompanies == null) {
       cachedCompanies = buildCompanies();
      //}

      return cachedCompanies;
     }

     /**
      * Returns a list of companies
      */
     private static List buildCompanies() {
      List result = new ArrayList();
       for (int i = 0; i < companies.length; i++) {
        Company company = new Company(i + 1, companies[i][0],
          companies[i][1], companies[i][2]);
        result.add(company);
       }
      return result;
     }

     private static Date createDate(String date) {
      Date d = new Date();
      d.setMonth(Integer.parseInt(date.substring(5, 7)));
      d.setYear(Integer.parseInt(date.substring(0, 4)) - 1900);
      d.setDate(Integer.parseInt(date.substring(9)));
      return d;
     }

     private static List buildEmployees(String city) {
      List result = null;
      Date date = new Date();
      result = new ArrayList();
      
      for (int j = 0 ; j < 10; j++) {
       for (int i = 0; i < employees.length; i++) {
        if ((city != null && city.equalsIgnoreCase(employees[i][5]))
          || city == null) {
         Person employee = new Person(i + 1, employees[i][1],
           employees[i][0], employees[i][2], employees[i][3],
           employees[i][4], employees[i][5],
           createDate(employees[i][6]), new Boolean(
             employees[i][7]).booleanValue(), new Integer(
             employees[i][8]).intValue());
         result.add(employee);
        }
       }
      }
      return result;
     }

     public static List buildManagers(){
      List result = null;
      Date date = new Date();
      result = new ArrayList();
      for (int j = 0 ; j < 10; j++) {
       for (int i = 0; i < managers.length; i++) {
         Person employee = new Person(i + 1, managers[i][1],
           managers[i][0], managers[i][2], managers[i][3],
           managers[i][4], managers[i][5],
           createDate(managers[i][6]), new Boolean(
             managers[i][7]).booleanValue(), new Integer(
               managers[i][8]).intValue());
         result.add(employee);
       }
      }
      return result;
      
     }
     private static List getCachedEmployees(String city) {
      List result = null;
      //Rebuild every time because we don't want anybody to edit the companies in the demo site
      //if (cachedEmployees == null) {
       cachedEmployees = new HashMap();
      //}
      result = (List) cachedEmployees.get(city);
      if (result == null) {
       result = buildEmployees(city);
       cachedEmployees.put(city, result);
      }
      return result;
     }

     public static List getEmployees() {
      return getCachedEmployees(null);
     }

     private static List mapEmployees;

     public static List getMapEmployees() {
      try {
       if (mapEmployees == null) {
        mapEmployees = new ArrayList();

        for (Iterator it = getEmployees().iterator(); it.hasNext();) {
         Person employee = (Person) it.next();
         Map map = new HashMap();

         map.put("city", employee.getCity());
         map.put("country", employee.getCountry());
         map.put("email", employee.getEmail());
         map.put("firstName", employee.getFirstName());
         map.put("hireDate", employee.getHireDate());
         map.put("lastName", employee.getLastName());
         map.put("phoneNumber", employee.getPhoneNumber());
         map.put("age", new Integer(employee.getAge()));
         map.put("married", new Boolean(employee.getMarried()));
         mapEmployees.add(map);
        }
       }
      } catch (Exception e) {
       e.printStackTrace();
      }

      return mapEmployees;
     }

     public static List getEmployeesPerCity(String city) {
      return getCachedEmployees(city);
     }
     
    }