You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Mike Whittaker <mi...@ntlworld.com> on 2003/05/27 18:34:21 UTC

Parameters v form beans (again!)

I know I've been here before, but it is my main sticking point.

Does anyone JUST use the Form Beans as a html form backend,
whether that is for pre population or validation or both.

BUT

Then decide that is easier to use the request parameters as a java.util.Map
in the business layer.

I know I can do this, I'm just looking for some moral support :-)

Is in fact the ONLY reasoning behind ActionForms that you can easily
prepopulate.

--
Mike W


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


Re: Parameters v form beans (again!)

Posted by Mark Lowe <ma...@talk21.com>.
umm..

i'm afraid you wont have any moral support from me. your not only 
talking about html forms but a way of thinking about systems in an 
understandable way from a number of different perspectives. Form beans 
give a convenient way of representing a form both to programmers and 
site builders.

the principle to my mind is a bit like punks who still talk about 
cookies and not sessions. personally i'm pretty stupid, I don't want to 
think about cookies i want to think about sessions. likewise i prefer 
to think about "forms" not parameter maps.

now thinking in parameters is a handy thing, you can think like this 
and solve problems in asp, php, jsp, and perl (and i imagine others), 
from this point of view i sympathise with your position, just not very 
much.

although i don't use an IDE (because they confuse me) i think its 
important to follow patterns in such a way that folks that do can see 
what's going one with my code. Now to my reckoning using the param map 
isn't going to play the game in the same way (i could be wrong), also 
the struts form tags could also work with an IDE.


there's more.. but i wanna play pool on pogo..

cheers mark

On Wednesday, May 28, 2003, at 00:05 Europe/London, Mike Whittaker 
wrote:

>>
>> But I think you really take a step back if you are going to tie all 
>> of your
>> code to the request map.  You'll lose the validation capabilities
>> of struts and
>> the pre-population of forms.
>
> So in fact the ONLY reasoning behind ActionForms is that you can easily
> prepopulate?
> And I don't see how validation is made any easier.  Unless of course 
> Struts
> magically knows better than I do what my data should look like!
>
> So really if I decide the advantages just don't add up for my use, 
> then I
> can ditch the ActionForm and the tags, but I do still like the tags 
> like
> <html:optionsCollection>, can't see why I can't use those.
>
> So the only tags that rely on a Form Bean are those that accept user 
> input?
>
>> If you were going to use
>> DynaActionForms, you'll
>> lose some typecasting like with <form-property name="itemIdsToDelete"
>> type="java.lang.Integer[]" />.
>>
>> Mike Whittaker wrote:
>>
>>> I know I've been here before, but it is my main sticking point.
>>>
>>> Does anyone JUST use the Form Beans as a html form backend,
>>> whether that is for pre population or validation or both.
>>>
>>> BUT
>>>
>>> Then decide that is easier to use the request parameters as a
>> java.util.Map
>>> in the business layer.
>>>
>>> I know I can do this, I'm just looking for some moral support :-)
>>>
>>> Is in fact the ONLY reasoning behind ActionForms that you can easily
>>> prepopulate.
>
> Any more takers?
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: struts-user-help@jakarta.apache.org
>


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


RE: Parameters v form beans (again!)

Posted by Mike Whittaker <mi...@ntlworld.com>.
>
>But I think you really take a step back if you are going to tie all of your
>code to the request map.  You'll lose the validation capabilities
>of struts and
>the pre-population of forms.

So in fact the ONLY reasoning behind ActionForms is that you can easily
prepopulate?
And I don't see how validation is made any easier.  Unless of course Struts
magically knows better than I do what my data should look like!

So really if I decide the advantages just don't add up for my use, then I
can ditch the ActionForm and the tags, but I do still like the tags like
<html:optionsCollection>, can't see why I can't use those.

So the only tags that rely on a Form Bean are those that accept user input?

>If you were going to use
>DynaActionForms, you'll
>lose some typecasting like with <form-property name="itemIdsToDelete"
>type="java.lang.Integer[]" />.
>
>Mike Whittaker wrote:
>
>> I know I've been here before, but it is my main sticking point.
>>
>> Does anyone JUST use the Form Beans as a html form backend,
>> whether that is for pre population or validation or both.
>>
>> BUT
>>
>> Then decide that is easier to use the request parameters as a
>java.util.Map
>> in the business layer.
>>
>> I know I can do this, I'm just looking for some moral support :-)
>>
>> Is in fact the ONLY reasoning behind ActionForms that you can easily
>> prepopulate.

Any more takers?


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


Re: Parameters v form beans (again!)

Posted by Carl Walker <wa...@georgetown.edu>.
I use the request object to deal with parameters whose names aren't known in
advance.  For instance, I had an app that allowed the user to associate
attributes "on-the-fly" with a given record.  So I used the identifier for
these schema-changing attributes to come up with <input type="text"> names like
"attr_54" and "attr_2".  These parameters pointed to a db table of attribute
definitions.  The values of the <input type="text"> were used to populate a
different db table that held the attribute data.

I used the request parameters alongside a DynaValidatorForm for the fields that
I did know ahead of time.

But I think you really take a step back if you are going to tie all of your
code to the request map.  You'll lose the validation capabilities of struts and
the pre-population of forms.  If you were going to use DynaActionForms, you'll
lose some typecasting like with <form-property name="itemIdsToDelete"
type="java.lang.Integer[]" />.

Mike Whittaker wrote:

> I know I've been here before, but it is my main sticking point.
>
> Does anyone JUST use the Form Beans as a html form backend,
> whether that is for pre population or validation or both.
>
> BUT
>
> Then decide that is easier to use the request parameters as a java.util.Map
> in the business layer.
>
> I know I can do this, I'm just looking for some moral support :-)
>
> Is in fact the ONLY reasoning behind ActionForms that you can easily
> prepopulate.
>
> --
> Mike W
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: struts-user-help@jakarta.apache.org


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