You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Oliver Thiel <th...@gmx.de> on 2004/01/16 09:05:39 UTC

Collection problem - for dynamic content with MapBackedForms

Hi all!
 
 
I still try to implement a ,real' dynamic form. So far I can build the
Form dynamically. Perform the validation dynamically. All changes can be
made by adding or deleting a database field. So you don't have to edit
the jsp or java files to change the form. But at the moment this things
are still static:
 
MESSAGE="KEY"
TYPE="TEXT" 
MAXLENGTH="20" 
CLASS="FELD"
 
<logic:iterate id="field" name="mapped">
<tr>
  <td><bean:write name="field" property="key"/>:</td>
  <td><input TYPE="TEXT" MAXLENGTH="20" name="field(<bean:write
name="field" property="key"/ 
           >)" value="<bean:write name="field" property="value" />"
CLASS="FELD"></td>               
</tr>
</logic:iterate>  
 
I tried to implement Maps which keep the values, but I did not manage to
iterate them properly. I also tried to use a list of maps which kept the
values, but there I had problems to define the Set- and Get- Methods
properly. 
 
 
The values I need to store are:
MESSAGE="KEY"
NAME="VALUE"           (Get-/Set-)
TYPE="TEXT" 
MAXLENGTH="20" 
CLASS="FELD"
 
 
Has any one a good suggestion which Collection I could use? And or has
someone done something comparable and can provide my some sample code? 
 
 
Have a nice weekend
Oliver