Hi David

html forms can only support a limited number of types, textbox, textarea, radio,
checkbox, selection box, and then some variations like password and file.  As 
far as I
am aware you can't pass a person object and expect Struts to work out the
form...maybe there is some technology that does this.

Personally I would still use the custom taglibrary.  You can display different 
types, you
can also generate the input fields for the appropriate type using the custom 
taglibrary.

I have a taglibrary function for displaying bean properties. Pass in the right 
parameters
and it displays the appropriate input field and surrounding label and help 
text.  With a
few changes I could pass it a type/value pair and it could probably work out the
appropriate input type to display.

Anyways, this is about as far as my experience goes.  You'll have to wait for my
brother billy goat who is much larger and wiser than I, maybe he will have more 
ideas.

Cheers
mc

On 21 Sep 2005 at 13:22, David Delbecq wrote:

> Sorry I was not clear.
> Am not asking how to display it in the JSP. This part is quite
> straightforward.
> What am wondering is how does struts manage the submission of form by user.
> If I take the simple example where parameter[0] is to be holder a String and
> parameter[1] to be the holder of a Person.
> I assume generate this kind of form as result of jsp
> <form (details on submission here)>
> <input type="hidden" name="parameter[0].type" value="java.lang.String"/>
> <input type="text" name="parameter[0].value" value="default content 0"/>
> <input type="hidden" name="parameter[1].type"
> value="com.mycompany.beans.Person"/>
> <input type="text" name="parameter[1].value.firstname" value="default
> firstname"/>
> <input type="text" name="parameter[1].value.lastname" value="default
> lastname"/>
> </form>
>
> I was thinking to have a form with an array of VariableParameter.
> VariableParameter is a custome bean which have 2 properties.
> One String for type and one 'Object' for the value.
> Perhaps having value as a DynaBean which is then converted to
> real type when type is known.
> I know there are converter thingies in beanutils used by struts.
> Am just wondering if there is an easy way to manage the final convertion
> (probably during the validate step if struts is unable to handle it by
> itself)
> from a DynaBean to SomeCustomClass
>
> thanks
> Murray Collingwood a écrit :
>
> >On reading this I initially thought you had an array of objects where each 
> >object was
a
> >group of objects such as a file, an int, a string etc.  Then I wondered 
> >whether your
array
> >of objects was just that, the first object a file, the second object an int, 
> >the third
object a
> >string etc.  Obviously this is more complicated.  It sounds as though you 
> >are asking
if
> >Struts has some sort of reflection....yes!
> >
> >It's called custom tag libraries.
> >
> >Pass the object to a custom tag library and deal with it appropriately.
> >
> >When you pass the object it will be just that, an object, unless you also 
> >pass the
type,
> >for example:
> >Object object;
> >String objectType;
> ><mylib:display obj="${attributeName.property1} "
> >objType="${attributeName.property2}"/>
> >
> >Kind regards
> >mc
> >
> >
> >On 21 Sep 2005 at 10:32, David Delbecq wrote:
> >
> >
> >
> >>Hello,
> >>
> >>I'm seeking for help/documentation pointers on how to
> >>manage custom data-types in struts.
> >>Am wanting to know if it's possible to manage complex data-type
> >>(that is data-types which need more than one field to be displayed / filled)
> >>All this considering my form contains an array named parameters[]
> >>with each parameter being either a File, an int, a String, a complex type.
> >>
> >>Thanks a lot.
> >>
> >>
> >>---------------------------------------------------------------------
> >>To unsubscribe, e-mail: [EMAIL PROTECTED]
> >>For additional commands, e-mail: [EMAIL PROTECTED]
> >>
> >>
> >>
> >>--
> >>No virus found in this incoming message.
> >>Checked by AVG Anti-Virus.
> >>Version: 7.0.344 / Virus Database: 267.11.3/107 - Release Date: 20/09/2005
> >>
> >>
> >>
> >
> >
> >
> >FOCUS Computing
> >Mob: 0415 24 26 24
> >[EMAIL PROTECTED]
> >http://www.focus-computing.com.au
> >
> >
> >
> >
> >
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>
>
> --
> No virus found in this incoming message.
> Checked by AVG Anti-Virus.
> Version: 7.0.344 / Virus Database: 267.11.3/107 - Release Date: 20/09/2005
>



FOCUS Computing
Mob: 0415 24 26 24
[EMAIL PROTECTED]
http://www.focus-computing.com.au



--
No virus found in this outgoing message.
Checked by AVG Anti-Virus.
Version: 7.0.344 / Virus Database: 267.11.3/107 - Release Date: 20/09/2005


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to