Hello folks,
 
I have the following problem using <nested:iterate> and <logic:iterate> tags. Please 
help me some one.

Problem:

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 />
</logic:iterate>

b. using nested:iterate
 
<nested:iterate name="perfTestGradeForm" property="traineeScoresList" >
<nested:text property="score" size="5" maxlength="4" /><br />
</nested:iterate>
 
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 perftestgradeform.java: 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(Vector.java:713)
at org.apache.commons.beanutils.PropertyUtils.getIndexedProperty(Propert
yUtils.java:521)
at org.apache.commons.beanutils.PropertyUtils.getIndexedProperty(Propert
yUtils.java:428)
at org.apache.commons.beanutils.PropertyUtils.getNestedProperty(Property
Utils.java:770)
at org.apache.commons.beanutils.PropertyUtils.getProperty(PropertyUtils.
java:801)
at org.apache.commons.beanutils.BeanUtils.setProperty(BeanUtils.java:881
)
at org.apache.commons.beanutils.BeanUtils.populate(BeanUtils.java:808)
at org.apache.struts.util.RequestUtils.populate(RequestUtils.java:1096)
at org.apache.struts.action.RequestProcessor.processPopulate(RequestProc
essor.java:816)
at org.apache.struts.action.RequestProcessor.process(RequestProcessor.ja
va:254)
at org.apache.struts.action.ActionServlet.process(ActionServlet.java:142
0)
at org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:520)

at javax.servlet.http.HttpServlet.service(HttpServlet.java:760)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:360
)
at org.mortbay.jetty.servlet.WebApplicationHandler.dispatch(WebApplicati
onHandler.java:294)
at org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:5
58)
at org.mortbay.http.HttpContext.handle(HttpContext.java:1714)
at org.mortbay.jetty.servlet.WebApplicationContext.handle(WebApplication
Context.java:507)
at org.mortbay.http.HttpContext.handle(HttpContext.java:1664)
at org.mortbay.http.HttpServer.service(HttpServer.java:863)
at org.jboss.jetty.Jetty.service(Jetty.java:460)
at org.mortbay.http.HttpConnection.service(HttpConnection.java:775)
at org.mortbay.http.HttpConnection.handleNext(HttpConnection.java:939)
at org.mortbay.http.HttpConnection.handle(HttpConnection.java:792)
at org.mortbay.http.SocketListener.handleConnection(SocketListener.java:
201)
at org.mortbay.util.ThreadedServer.handle(ThreadedServer.java:289)
at org.mortbay.util.ThreadPool$PoolThread.run(ThreadPool.java:455)


Again Thanks,
Kamal.

---------------------------------------------------------------------
"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"

"YOU SEE THINGS AND SAY,'WHY?,' BUT I DREAM THINGS AND SAY,'WHY
NOT?'" - Goerge Bernard Shaw
---------------------------------------------------------------------








---------------------------------
Do you Yahoo!?
SBC Yahoo! DSL - Now only $29.95 per month!

Reply via email to