struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Adam Gordon <>
Subject RE: Struts form design question
Date Tue, 01 Aug 2006 15:08:47 GMT

I'll check out that link after I send this.  We found a demo online
somewhere but it's from 2004, and doesn't appear to be working for us -
we're getting an NPE when struts is trying to render a property for a bean
in the array of bean objects - using the debugger, I can see that the fields
are not negative, so I'm not sure what's going on however, adding the value
attribute to the &lt;html:input&gt; element, oddly enough, caused this error
to go away...

So, by row, I mean our table could look like this (make sure you are
using a fixed-width font):

--- SNIP ---

|                   | Field Name                           | Required   | 
| [ Remove Button ] |Name                                  | [Checkbox] |
| [ Remove Button ] |Email                                 | [Checkbox] |
| [ Remove Button ] |Phone                                 | [Checkbox] |
| [ Remove Button ] |Company                               | [Checkbox] |
| [ Add Field Button ]                                                  |

              [ Preview ] [ Default ] [ Save ] <-- More buttons

--- SNIP ---

So, to answer your question, don't worry about the concept of

The [ Remove Button ] is the remove button for that row and the [Add
Field Button] inserts a new row in the table.  Right now these are both
done w/ JavaScript.  The table is initially populated via database
parameters but a user can customize the field names or get rid of some
entirely.  We don't want live-editing of the database meaning if the
user clicks Remove or Add, no contact w/ the server is done.  We want
this because if the user clicks Default, we want to reload the page
from the database with the user's current setup whereas if they click
save, we want to read the table and determine the new/changed/deleted
fields they've added/modified/removed.  It would be awesome if Struts
did this automatically on form submittal but I'm not sure it can.

Hope that was clear.  Thanks,


-----Original Message-----
From: Antonio Petrelli [] 
Sent: Tuesday, 01 August 2006 04:04
To: Struts Users Mailing List
Subject: Re: Struts form design question

Adam Gordon ha scritto:
> We have a table which we populate with a user's choice of custom
> registration fields (name, email, phone, company, etc...).

Probably this can help you:
Go to section: 4.3.3 Map-backed ActionForms (Adam, thank Frank W. 
Zammetti for this!)

> Each row in this
> table is essentially a button to remove the row, a text field to enter the
> name of the field, and a checkbox to indicate whether or not that
> field is required when a user registers.  At the bottom of the table is an
> "Add Field" button which will insert a new row in the table. 

What do you mean with "row" here? Are there more that one user 
displayed, like a data grid?


To unsubscribe, e-mail:
For additional commands, e-mail:

  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message