Vinicius Carvalho wrote:
Hi there!
I have the following problem:
My form offers the ability to a user select from some categories, let's say first grade, second grade
on the next step user selects subjects for each one:
first grade: Math English Science
second grade: Math English History
As you can see, a subject can participate on more than one grade. Those values are retreived and then the form must be
dynamic created. Now that's my question? What can I do about it? Is it possible to create an array of those dtos? I'm kinda lost with this issue.
There's another one similar to that, refering to textareas, I must create n textAreas for the user, depending on how many I've got on my database (it's like a metadata)
Any ideas please?
If I understand you correctly I have had the same problem here, trying to dynamically use nested properties in a JSP page using Struts.
The way that I solved it was using EL combined with <iterate> tags with an index, a little like this:
If you have the grades in one array, called grades, stored in session scope, and the underlying properties, the subjects, contained as properties in those grades objects I would do this:
<logic:iterate name="grades" scope="session" indexId="gradeId">
<logic:iterate name="grades[${gradeId}].subjects}" scope="session" index="subject" indexId="subjectId">
<bean write name="subject" property="title" />
</logic:iterate>
</logic:iterate>
Here I assume that you have a little like these objects: grade: private Subject[] subjects; public Subject[] getSubjects();
subject: private String title; public String getTitle();
Hope that helps a little...
Claus
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]