I am doing something very basic.
First, I display my 1stTable with a checkbox for each
row (no problem). My DepartureManagementBean.java read
the user selected rows and prepare for displaying my
2ndTable without checkbox for each row. My 2ndTable
displays only the rows that are selected from the
1stTable.
I can display the 2ndTable. But, the problem is that
if I re-visit the 1stTable and make another round of
selections, the new selections get append to the
previous selections and all of them are displayed in
the 2ndTable.
I know I have to do some clean-up but my attempts have
been unsuccessful. Please advise.
DepartureManagementBean:
[code]
package processAction;
import java.util.ArrayList;
import java.util.List;
import processDelegate.ListPersonnel;
import processDelegate.PersonnelBean;
public class DepartureManagementBean
{
private List personnel = new ArrayList();
private List departurePersonnel = new ArrayList();
public DepartureManagementBean()
{
// instantiate the business delegate
ListPersonnel listPersonnel = new
ListPersonnel();
personnel = listPersonnel.getPersonnelInfo();
}
/**
* @return Returns the personnel.
*/
public List getPersonnel()
{
return personnel;
}
/**
* @param personnel The personnel to set.
*/
public void setPersonnel( List personnel )
{
this.personnel = personnel;
}
public String updateDeparturePersonnel()
{
// iterate through the data rows ...
for ( int index = 0; index < personnel.size();
index++ )
{
PersonnelBean personnelBean = ( PersonnelBean
)personnel.get( index );
// If this row is selected, add all data
fields the corresponding message
if ( personnelBean.isSelectedPersonnel()
)
{
departurePersonnel.add( personnelBean
);
}
}
return "success";
}
/**
* @return Returns the departurePersonnel.
*/
public List getDeparturePersonnel()
{
return departurePersonnel;
}
/**
* @param departurePersonnel The departurePersonnel
to set.
*/
public void setDeparturePersonnel( List
departurePersonnel )
{
this.departurePersonnel = departurePersonnel;
}
}// End DepartureManagementBean.java
[/code]
____________________________________________________________________________________Take
the Internet to Go: Yahoo!Go puts the Internet in your pocket: mail, news,
photos & more.
http://mobile.yahoo.com/go?refer=1GNXIC