struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Khalid K." <gro...@maikada.com>
Subject Re: multi row / multi col input forms
Date Thu, 02 Jan 2003 21:50:46 GMT
please read the post below from Craig....(he answered a similar
question..see question/answer below)



On Thu, 2 Jan 2003, Toni Charlot wrote:

> Date: Thu, 2 Jan 2003 10:10:32 -0500
> From: Toni Charlot <developer@fdplus.com>
> Reply-To: Struts Users Mailing List <struts-user@jakarta.apache.org>,
>      developer@fdplus.com
> To: struts-user@jakarta.apache.org
> Subject: REPOST: Forcing the ActionForm to populate a field before the
>     other
>
> I would like to have a setter method called before another.  What's the
> best way to do that in the ActionForm

There are no guarantees on the order that the setters are called.  This is
for two reasons:

* There is no rule in the HTTP or HTML specs defining the order
  in which the request parameters are sent, so it's totally up
  to the client.  And they really do operate differently.

* There is no rule in the servlet spec saying that the input order
  has to be preserved, so it's totally up to the container to decide
  how to implement this.  And they really do operate differently.

More fundamentally, though, the only reason that the setter order would
matter is if there are side effects (setting one property affects the
semantics of setting a different one).  Designing your form beans in this
way is a very poor architectural decision -- the whole point of a form
bean is to simply represent the input values that the user actually
entered on the form.  Any functionality that tries to assign "meaning" to
these inputs should be done in business logic (which can pull data out of
the form bean in any order that you need), not in the form bean itself.

>
> Thank you.

Craig McClanahan



--
To unsubscribe, e-mail:
<mailto:struts-user-unsubscribe@jakarta.apache.org>
For additional commands, e-mail:
<mailto:struts-user-help@jakarta.apache.org>



----- Original Message -----
From: "Mike Ash" <mash@euronetworldwide.com>
To: <struts-user@jakarta.apache.org>
Sent: Thursday, January 02, 2003 1:46 PM
Subject: multi row / multi col input forms


> Is there a way to get the inputs from an html form that has something
like:
>
> col1 col2 col3
> row x x x
> row x x x
> row x x x
>
> where x may or may not be entered and the input boxes are named like col1,
> col2, col3.
>
> So if a user enter a number in row2, col1 and row3, col1 how to tell that
it
> was row 2 and 3 that where entered because hen inputs are named the same
the
> parameters come back to the server as an array but there is no guarantee
> which order they were in especially if the first one was blank as in this
> case.  The array looks like I had two entries in col1 but the numbers are
in
> position 0, and 1.  which they should be in position 1 and 2.
>
> Any thoughts.
>


--
To unsubscribe, e-mail:   <mailto:struts-user-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:struts-user-help@jakarta.apache.org>


Mime
View raw message