i'll send u some code that u can adapt for Vectors that we used quite
effectively with Arraylists, try it out...
we used like a wrapper class to put our collection object in as follows:
-----------------------------------------
package com.didata.itax.payment.web.data;
import java.util.ArrayList;
/**
* Title:
* Description:
* Copyright: Copyright (c) 2001
* Company:
* @author
* @version 1.0
*/
public class EFilerList {
private ArrayList list = null;
private int size = 0;
public int getSize(){
return list.size();
}
public EFilerList() {
list = new ArrayList();
}
public EFilerList(ArrayList newList) {
list = newList;
}
public void addEFiler(EFiler efiler){
list.add(efiler);
}
public void removeEFiler(int eFilerID){
list.remove(eFilerID);
list.trimToSize();
}
public EFiler[] getEfilers(){//the iterate tags property="efilers" will
call this method!!
EFiler[] eFilers = new EFiler[list.size()];
eFilers = (EFiler[])list.toArray(eFilers);
return eFilers;
}
public EFiler getEfiler(int eFilerID){
EFiler eFiler = new EFiler();
eFiler = (EFiler)list.get(eFilerID);
return eFiler;
}
}
in your actionform or wherever u build the vector, use the above class to
wrap your Vector, then, u push this list class above as your session object.
This class is juts a wrapper, so we can access the ArrayList or Vector in
our jsp. Once you've built EFilerList, put all the elements in it that u
need, add it to the session session.setAttribute...etc
the jsp for the above example looks like this
<logic:iterate id="eFilerList"
name="eFilerList" scope="session" property="efilers">
<tr>
<td align="center">
<bean:write name="eFilerList"
property="firstName" filter="true"/>
</td>
<td align="center">
<bean:write name="eFilerList"
property="initials" filter="true"/>
</td>
<td align="center">
<bean:write name="eFilerList"
property="lastName" filter="true"/>
</td>
<td align="center">
<bean:write name="eFilerList"
property="idNumber"/>
</td>
<td align="center">
<bean:write name="eFilerList"
property="state"/>
</td>
<td align="center">
<html:link
page="/eFilerEdit.do?action=Edit" ><bean:message
key="eFilerList.edit"/>/html:link>
</td>
<td align="center">
<html:checkbox name="eFilerList"
property="state"/>
</td>
</tr>
</logic:iterate>
the eFiler class looks like this.....
package com.didata.itax.payment.web.data;
import com.didata.itax.payment.web.actionform.*;
/**
* Title:
* Description:
* Copyright: Copyright (c) 2001
* Company:
* @author
* @version 1.0
*/
public class EFiler implements java.io.Serializable {
String firstName = null;
String initials = null;
String lastName = null;
String idNumber = null;
Boolean state = new Boolean(false);
public EFiler() {
}
public EFiler(EFilerActionForm eFilerForm) {
firstName = eFilerForm.getFirstName();
initials = eFilerForm.getInitials();
lastName = eFilerForm.getLastName();
idNumber = eFilerForm.getIdNumber();
state = eFilerForm.getState();
}
public Boolean getState(){
return state;
}
public void setState(Boolean _state){
this.state = _state;
}
public String getFirstName(){
return firstName;
}
public void setFirstName(String firstName){
this.firstName = firstName;
}
public String getInitials(){
return initials;
}
public void setInitials(String initials){
this.initials = initials;
}
public String getLastName(){
return lastName;
}
public void setLastName(String lastName){
this.lastName = lastName;
}
public String getIdNumber(){
return idNumber;
}
public void setIdNumber(String idNumber){
this.idNumber = idNumber;
}
}
-----Original Message-----
From: Sylvain FAGNENT [mailto:[EMAIL PROTECTED]]
Sent: Thursday, May 10, 2001 4:16 PM
To: [EMAIL PROTECTED]
Subject: Re: Logic iterate problems
Doesn't work since we retrieve the following exception:
"javax.servlet.jsp.JspException: No getter method for property choix of bean
tabTest"
tabTest is a Vector!!
----- Original Message -----
From: "Dudley Butt@i-Commerce" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Thursday, May 10, 2001 3:45 PM
Subject: RE: Logic iterate problems
> try this
>
> <logic:iterate id="tabTest" name="tabTest" scope="session" type="Client">
> > <bean:write name="tabTest" property="name"/>
> > </logic:iterate>
>
> -----Original Message-----
> From: Sylvain FAGNENT [mailto:[EMAIL PROTECTED]]
> Sent: Thursday, May 10, 2001 3:37 PM
> To: [EMAIL PROTECTED]
> Subject: Re: Logic iterate problems
>
>
> I tried to encapsulate all my tags with
> <html:form action="realAction">
> ......
> </html:form>
>
> But it still doesn't work !
> ----- Original Message -----
> From: "Firmin David" <[EMAIL PROTECTED]>
> To: <[EMAIL PROTECTED]>
> Sent: Thursday, May 10, 2001 3:22 PM
> Subject: RE: Logic iterate problems
>
>
> > I came across a similar problem not so long ago. What I'd done wrong was
> try
> > and access properties outside the <html:form> tags.
> > Moving my tag calls inside the form tags fixed my problem at the time,
but
> I
> > don't know if this applies in your case. It's worth double checking
> > none-the-less.
> >
> > Regards
> > David
> >
> > -----Original Message-----
> > From: Sylvain FAGNENT [mailto:[EMAIL PROTECTED]]
> > Sent: 10 May 2001 13:57
> > To: [EMAIL PROTECTED]
> > Subject: Logic iterate problems
> >
> >
> > Hello,
> >
> > I have a Vector Object stored in my session with the key "tabTest" this
> > Vector
> > contains "Client" Objetcs, Client classe have a "name" property.
> >
> > I use this code in my JSP :
> >
> > <logic:iterate id="client" name="tabTest" scope="session" type="Client">
> > <bean:write name="client" property="name"/>
> > </logic:iterate>
> >
> > This error is return :
> >
> > ...JSP Exception : Cannot find bean client in scope null....
> >
> > any help...Thanks
> >
> > Sylvain
> >
> >
> >
> > ************************************************************************
> > The information in this email is confidential and is intended solely
> > for the addressee(s).
> > Access to this email by anyone else is unauthorised. If you are not
> > an intended recipient, you must not read, use or disseminate the
> > information contained in the email.
> > Any views expressed in this message are those of the individual
> > sender, except where the sender specifically states them to be
> > the views of Capco.
> >
> > http://www.capco.com
> > ***********************************************************************
> >
> >
>