Hello Kamal,
Did you ever get a fix for this problem?
- Malcolm

-----Original Message-----
From: Kamalakar Thota [mailto:[EMAIL PROTECTED]
Sent: Tuesday, June 17, 2003 1:20 PM
To: Struts Developers List
Subject: Form bean population for <logic:iterate> and
<nested:iterate>
tags


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.getIndexedPropert
y(Propert
yUtils.java:521)
at
org.apache.commons.beanutils.PropertyUtils.getIndexedPropert
y(Propert
yUtils.java:428)
at
org.apache.commons.beanutils.PropertyUtils.getNestedProperty
(Property
Utils.java:770)
at
org.apache.commons.beanutils.PropertyUtils.getProperty(Prope
rtyUtils.
java:801)
at
org.apache.commons.beanutils.BeanUtils.setProperty(BeanUtils
.java:881
)
at
org.apache.commons.beanutils.BeanUtils.populate(BeanUtils.ja
va:808)
at
org.apache.struts.util.RequestUtils.populate(RequestUtils.ja
va:1096)
at
org.apache.struts.action.RequestProcessor.processPopulate(Re
questProc
essor.java:816)
at
org.apache.struts.action.RequestProcessor.process(RequestPro
cessor.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(Web
Applicati
onHandler.java:294)
at
org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandl
er.java:5
58)
at
org.mortbay.http.HttpContext.handle(HttpContext.java:1714)
at
org.mortbay.jetty.servlet.WebApplicationContext.handle(WebAp
plication
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.ja
va:939)
at
org.mortbay.http.HttpConnection.handle(HttpConnection.java:7
92)
at
org.mortbay.http.SocketListener.handleConnection(SocketListe
ner.java:
201)
at
org.mortbay.util.ThreadedServer.handle(ThreadedServer.java:2
89)
at
org.mortbay.util.ThreadPool$PoolThread.run(ThreadPool.java:4
55)


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!


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to