On Mon, 15 Jul 2002, Anjana Wijayaweera wrote:

> Date: Mon, 15 Jul 2002 20:14:33 +0600
> From: Anjana Wijayaweera <[EMAIL PROTECTED]>
> Reply-To: Struts Users Mailing List <[EMAIL PROTECTED]>
> To: Struts Users Mailing List <[EMAIL PROTECTED]>
> Subject: RE: DynaBeans, DynaClass, DynaMen
>
> Hi All,
>
>       I need to know if there is any Struts Tag being developed for 1.1
> whiich supports Dynabeans in a
> truely dynamic way.
>

For form beans, there is no support for "completely dynamic" beans in the
sense that you are talking about, and such support is very unlikely to get
added before 1.1 final is released (we need to get it out the door).
There are some interesting complications to designing such a thing,
because Struts needs to know what the properties are *before* it can
populate the form bean.

For displaying information, the existing tags like <bean:write> already
fully support DynaBean instances, and don't care where they came from.
Remember that org.apache.commons.beanutils.DynaBean is an *interface*, so
you can create your own custom implementations -- for example, the
ResultSetDynaClass implementation discussed earlier in this message thread
is an example of creating "completely dynamic" DynaBeans from a result
set.  The iterator returned by this class could easily be used, for
example, inside a <logic:iterate> loop to display the corresponding
values, as long as you obey the programming restrictions.

Craig



> I have seen examples which go like this
> <bean:write name="dynabean" property="property1"/>  BUT this doesn't answer
> my requirement since I need to have a really
> dynamic page and won't be knowing  what the name of the property is which is
> a requirement to use the bean :write tag.
>
> My requirement is to read from a database table a list of custom fields
> which may vary from zero, one to many
> and I have no way of knowing the names of the fields since its dynamic. I
> want to handle this within the
> Struts framework therfore if you have any ideas let me know. I am open to
> any suggestions.
>
>
>
> Regards,
> Anjana
>
>
>
>
> From: Adolfo Miguelez
> Subject: RE: DynaBeans, DynaClass, DynaMen
> Date: Mon, 01 Jul 2002 09:54:52 -0700
>
> ----------------------------------------------------------------------------
> ----
>
>
> By using dynabeans should not need to modify the custom tags at all.
> BeansUtils package is able to inspect dynabeans itself.
>
> The advantage is that you have not to worry about making your modified
> custom tags for each new release.
>
> Adolfo
>
> >From: [EMAIL PROTECTED]
> >Reply-To: "Struts Users Mailing List" <[EMAIL PROTECTED]>
> >To: [EMAIL PROTECTED]
> >Subject: RE: DynaBeans, DynaClass, DynaMen
> >Date: Mon, 1 Jul 2002 12:10:51 -0400
> >
> >
> >Yep, the display tag library...
> >
> >I spent some time looking at the source last night, and modifying it
> >should not be that bad...
> >
> >Thanks for the feedback!
> >
> >-----Original Message-----
> >From: pelly69 [mailto:[EMAIL PROTECTED]]
> >Sent: Monday, July 01, 2002 11:05 AM
> >To: struts-user
> >Subject: Re: DynaBeans, DynaClass, DynaMen
> >
> >
> >I have implemented the same approach: getting results from a database
> >query
> >and wrap them in an ArrayList of dynabeans. In that way I can use the
> >Struts
> >Customs tags in order to render the dynabeans content in the JSP.
> >
> >Custom Tags rely on Commons BeanUtils package which is able to inspect
> >any
> >Java Bean or Dynabean to pick up the information.
> >
> >I think your approach is correct,
> >
> >Adolfo.
> >
> >
> > >From: [EMAIL PROTECTED]
> > >Reply-To: "Struts Users Mailing List" <[EMAIL PROTECTED]>
> > >To: [EMAIL PROTECTED]
> > >Subject: DynaBeans, DynaClass, DynaMen
> > >Date: Mon, 1 Jul 2002 10:39:46 -0400
> > >
> > >
> > >...anyone remember DynaMen?
> > >
> > >Anyhow...  I got a Dynabean mechanism working that builds a DynaBean
> > >based on the metadata of a SQL result set, populates and array of the
> > >little buggers and passes it back to me.  For displaying I have a tag
> > >library that does not like a call to get('name') as the field name.
> > >What is the best way to get around this?
> > >
> > >(A) Write a bean to encapsulate the dynabean and provide hard method
> > >gets and sets
> > >(B) Modify the tag library to detect a DynaBean and access it via a get
> > >and set (not my library)
> > >(C) Don't use dynabeans for this sort of thing
> > >(D) None of the above you dufus
> > >
> > >I can do any of the above - I just want to make sure that there is not
> > >an obvious way I am missing.
> > >
> > >Thanks and happy monday
> > >
>
>
> --
> To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>
>
>


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

Reply via email to