Its hard to help when all you say is "failed to make their examples work". Posting snippets of relevant bits of your struts-config.xml, jsp etc would help along with what actually happened.
Sorry for the lack of details, I know I was really too vague.
I am using Struts 1.2.4 .
So, here is what I want to do :
I have a list of text fields which number is unknown when the user gets to the JSP. Fields are added dynamically through JavaScript.
Now, I know there is Struts 1.2.6 on its way, but I can't wait for it to get a "stable" label.
So here is the example I was trying to follow (extracted from http://wiki.apache.org/struts/StrutsCatalogLazyList) :
[quote]
In fact using Arrays (rather than Lists) a LazyDynaBean can be used directly, in the following way:
<form-beans>
<form-bean name="skillForm"
type="org.apache.commons.beanutils.LazyDynaBean">
<form-property name="skills" type="myPackage.SkillBean[]"/>
</form-bean></form-beans> [/quote]
Supposedly, the LazyDynaBean object should be wrapped within a BeanValidatorForm one.
Here is what I am using in my struts-config.xml file :
<form-bean name="dynaLazyForm"
type="org.apache.commons.beanutils.LazyDynaBean">
<form-property name="nb" type="java.lang.String" />
<form-property name="persons"
type="net.beuarh.lasher.Person[]"/>
</form-bean>The class Person is really just a bean, with deux properties : name and fname.
Here is the JavaScript code I use to generate new text fields :
function foo() {
var nb = document.getElementById('nb').value;
var f = document.getElementById('f');
f.innerHTML = null;
f.innerHTML = "nb: "+
"<input type='text' id='nb' value='"+nb+"' /><br />";
for (var i = 0; i < nb; i++) {
f.innerHTML += "name: <input type='text' " +
"name='persons["+i+"].name' id='name' /><br />";
f.innerHTML += "first name:<input type='text' " +
"name='persons["+i+"].fname' id='fname' /><br />";
}
f.innerHTML += "<input type='submit' value='submit' />";
}The JSP is really basic (since this is a test) :
<html>
<head>
<html:base/>
<title>JSP for lazyForm form</title>
<script src="js.js" language="javascript"
type="text/javascript"></script>
</head>
<body>
<html:errors/>
<html:form action="/dynaLazy" styleId="f">
nb : <html:text property="nb" onblur="foo()" styleId="nb"/>
<br />
<html:submit/>
</html:form>
</body>
</html>... And my Action class is as simple as the JSP :
public final class DynaLazyAction extends Action {
public ActionForward execute(...) {
DynaValidatorForm dynaForm = (DynaValidatorForm) form;
// here is the line that makes it all crumble...
Person[] persons = (Person[]) dynaForm.get("persons"); request.setAttribute("persons",persons);
return mapping.findForward("ok");
}
}As I said before, when it is about "manual" forms, everything's fine, I use LazyLists, and it works (thank you so much, Rick; you made my morning wonderful :-) ).
I hope I wasn't too messy in my explanations ...
Thanks for any clue you might give me :-)
-- St�phane Zuckerman
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]

