struts-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Kamalakar Thota <>
Subject Form bean population for <logic:iterate> and <nested:iterate> tags
Date Tue, 17 Jun 2003 18:19:53 GMT
Hello folks,
I have the following problem using <nested:iterate> and <logic:iterate> tags.
Please help me some one.


When i set the values for first time in my action class and forward to jsp page i.e pre-populate
, the values are set and works well. But after prepopulating, when i change values in the
jsp page and try to submit the form, then i get the "BeanUtils.populate" errors. Is it because,
i am trying to populate list/some other reason?

Here i have listed
1. struts code
2. Form Bean code
3. TraineeScoresListBean code
4. Errors

Any suggestions? Please help me, ASAP. Thank You.

1. Here is my form using struts:

a. Using logic:iterate
<logic:iterate id="element" name="perfTestGradeForm" 
             property="traineeScoresList" >
       <html::text property="score" name="element" size="5" 
                           maxlength="4" /><br />

b. using nested:iterate
<nested:iterate name="perfTestGradeForm" property="traineeScoresList" >
<nested:text property="score" size="5" maxlength="4" /><br />
Here the list 'traineeScoresList' is collection of beans
'TraineeTaskScoreListBean' that has attribute 'score' of datatype 'String'.

2. Form Bean Code:

public final class PerfTestGradeFormBean extends ActionForm {
//this traineeScoresList will have TraineeTaskScoreListBean that has
// score as an attribute
private Collection traineeScoresList = new Vector();

public PerfTestGradeForm(){
this.traineeScoresList = new Vector();

public Collection getTraineeScoresList(){
System.out.println("In getTraineeScore...()");
return this.traineeScoresList;

public void setTraineeScoresList(Collection list){
this.traineeScoresList = list;

3. Here is Code for TraineeTaskScoreListBean:

public class TraineeTaskScoreListBean{
private String score;
public TraineeTaskScoreListBean(String score){
this.score = score;
public String getScore(){
return this.score;
public void setScore(String score){
this.score = score;

4. Errors:

java.lang.ArrayIndexOutOfBoundsException: Array index out of range: 1
at java.util.Vector.get(
at org.apache.commons.beanutils.PropertyUtils.getIndexedProperty(Propert
at org.apache.commons.beanutils.PropertyUtils.getIndexedProperty(Propert
at org.apache.commons.beanutils.PropertyUtils.getNestedProperty(Property
at org.apache.commons.beanutils.PropertyUtils.getProperty(PropertyUtils.
at org.apache.commons.beanutils.BeanUtils.setProperty(
at org.apache.commons.beanutils.BeanUtils.populate(
at org.apache.struts.util.RequestUtils.populate(
at org.apache.struts.action.RequestProcessor.processPopulate(RequestProc
at org.apache.struts.action.RequestProcessor.process(RequestProcessor.ja
at org.apache.struts.action.ActionServlet.process(
at org.apache.struts.action.ActionServlet.doPost(

at javax.servlet.http.HttpServlet.service(
at javax.servlet.http.HttpServlet.service(
at org.mortbay.jetty.servlet.ServletHolder.handle(
at org.mortbay.jetty.servlet.WebApplicationHandler.dispatch(WebApplicati
at org.mortbay.jetty.servlet.ServletHandler.handle(
at org.mortbay.http.HttpContext.handle(
at org.mortbay.jetty.servlet.WebApplicationContext.handle(WebApplication
at org.mortbay.http.HttpContext.handle(
at org.mortbay.http.HttpServer.service(
at org.jboss.jetty.Jetty.service(
at org.mortbay.http.HttpConnection.service(
at org.mortbay.http.HttpConnection.handleNext(
at org.mortbay.http.HttpConnection.handle(
at org.mortbay.http.SocketListener.handleConnection(
at org.mortbay.util.ThreadedServer.handle(
at org.mortbay.util.ThreadPool$

Again Thanks,

"When someone LAUGHS, you SMILE
When someone CRIES, make them SMILE" - Kamalakar Thota

"A winner is not one who never fails, but one who
never quits! In LIFE"

NOT?'" - Goerge Bernard Shaw

Do you Yahoo!?
SBC Yahoo! DSL - Now only $29.95 per month!
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message