Didn't get anywhere...probably just don't know what I am doing...

-----Original Message-----
From: Mike Ash [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, February 05, 2003 5:28 PM
To: 'Struts Users Mailing List'
Subject: RE: Lost in beans


Thanks, at least your home, I'm still here ;(, I am going to try and
implement this, I'll let you know what happens.

-----Original Message-----
From: Matthew Meyer [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, February 05, 2003 5:16 PM
To: Struts Users Mailing List
Subject: Re: Lost in beans


I was thinking about this more on my way home from work.. :)  As far as
doing it as a hack I would simply implement and register the converter as
anonymous class.

<form-bean
   name="NestedTestForm"
   type="org.apache.struts.action.DynaActionForm">
   <form-property name="value" type="java.lang.String" />
</form-bean>
<form-bean
   name="TestForm"
   type="org.apache.struts.action.DynaActionForm" >
   <form-property name="nested"
type="org.apache.struts.action.DynaActionForm" initial="NestedTestForm"/>
</form-bean>

Then in your initServlet()...
import org.apache.commons.beanutils.ConvertUtils;
import org.apache.commons.beanutils.Converter;

ConvertUtils.register(new Converter(){
      public Object convert(Class type, Object value){
         return
DynaActionFormClass.getDynaActionFormClass((String)value).newInstance();
      }
   }, DynaActionForm.Class);

Then when the app initialized DynaActionFormClass.newInstance() is called
for a TestForm it looks for a converter for the class DynaActionForm to set
the initial value an passes it the name "NestedTestForm."

Like I said before though didn't have time to test this today you might run
into other problems, and it would be much better if there was a permanent
solution..

Matt,



----- Original Message -----
From: "Mike Ash" <[EMAIL PROTECTED]>
To: "'Struts Users Mailing List'" <[EMAIL PROTECTED]>
Sent: Wednesday, February 05, 2003 4:36 PM
Subject: RE: Lost in beans


> Now its getting interesting, I was starting to look at a converter
solution
> as well but didn't get anywhere, got some concrete example I could admire?
>
> -----Original Message-----
> From: Matthew Meyer [mailto:[EMAIL PROTECTED]]
> Sent: Wednesday, February 05, 2003 4:29 PM
> To: Struts Users Mailing List
> Subject: Re: Lost in beans
>
>
> I was actually looking for an easy way to do just this
> (nest Dynas) for 4 hours today..
> The easiest hack(at least in my mind a hack) is to write a
> beanutils Converter to convert from a string to
> DynaActionFrom.
> Then when DynaActionFormClass.newInstance() sets the
> inital property values have your converter registered, and
> make sure the inital property in the XML for you nested
> DynaForm it set to the DynaForm you want to use. Then just
> implement the converter to do
>
> public Object convert(Class type, Object value){
>     return
> DynaActionFormClass.getDynaActionFormClass((String)value).newInstance();
>
> }
>
> I have not tested this yet as I would like a better way
> but I would call it a decent 'HACK'.
>
> Matt,
>
> On Wed, 5 Feb 2003 15:32:03 -0600
>   Mike Ash <[EMAIL PROTECTED]> wrote:
> >Guess its time to look at contributing...geez more coding
> >outside of
> >work...wife is going to love it
> >
> >-----Original Message-----
> >From: J Beginner [mailto:[EMAIL PROTECTED]]
> >Sent: Wednesday, February 05, 2003 3:31 PM
> >To: Struts Users Mailing List
> >Subject: RE: Lost in beans
> >
> >
> >Yes, I am back to extending ActionForm and
> >ValidatorForm.
> >I hope that nested DynaForms will be supported in the
> >near future.
> >
> >--- "Pani, Gourav" <[EMAIL PROTECTED]>
> >wrote:
> >> You can extend the ValidatorForm and use the
> >> validator framework.
> >>
> >> -----Original Message-----
> >> From: Mike Ash [mailto:[EMAIL PROTECTED]]
> >> Sent: Wednesday, February 05, 2003 4:25 PM
> >> To: 'Struts Users Mailing List'
> >> Subject: RE: Lost in beans
> >>
> >>
> >> So if your not using dynaforms are you back to
> >> extending actionform?  If so
> >> are you not using the validator framework either?
> >>
> >> -----Original Message-----
> >> From: J Beginner [mailto:[EMAIL PROTECTED]]
> >> Sent: Wednesday, February 05, 2003 3:19 PM
> >> To: Struts Users Mailing List
> >> Subject: Re: Lost in beans
> >>
> >>
> >> This is exactly the same as to what I am trying to
> >> do...no luck so far.
> >> I reverted back to using no DynaForms.
> >>
> >> --- Mike Ash <[EMAIL PROTECTED]> wrote:
> >> > Is it possible or is there a better way to do
> >> > something like
> >> >
> >> >
> >> >    <form-beans>
> >> >       <form-bean
> >> >             name="User"
> >> >
> >> >
> >>
> >type="org.apache.struts.validator.DynaValidatorForm">
> >> >          <form-property name="fname"
> >> > type="java.lang.String" />
> >> >          <form-property name="lname"
> >> > type="java.lang.String" />
> >> > <form-bean
> >> >     name="Addredd"
> >> >
> >> >
> >> type="org.apache.struts.validator.DynaValidatorForm"
> >> > >
> >> >     <form-property name="street"
> >> > type="java.lang.String" />
> >> >     <form-property name="city"
> >> > type="java.lang.String" />
> >> >   </form-bean>
> >> >         </form-bean>
> >> >    <form-beans
> >> >
> >> >
> >> > Basically looking for a way to nest beans in the
> >> > struts config and use them
> >> > in forms/actions/validation.
> >> >
> >> > Thanks
> >> >
> >>
> >>
> >> __________________________________________________
> >> Do you Yahoo!?
> >> Yahoo! Mail Plus - Powerful. Affordable. Sign up
> >> now.
> >> http://mailplus.yahoo.com
> >>
> >>
> >---------------------------------------------------------------------
> >> To unsubscribe, e-mail:
> >> [EMAIL PROTECTED]
> >> For additional commands, e-mail:
> >> [EMAIL PROTECTED]
> >>
> >>
> >---------------------------------------------------------------------
> >> To unsubscribe, e-mail:
> >> [EMAIL PROTECTED]
> >> For additional commands, e-mail:
> >> [EMAIL PROTECTED]
> >>
> >
> >
> >__________________________________________________
> >Do you Yahoo!?
> >Yahoo! Mail Plus - Powerful. Affordable. Sign up now.
> >http://mailplus.yahoo.com
> >
> >---------------------------------------------------------------------
> >To unsubscribe, e-mail:
> >[EMAIL PROTECTED]
> >For additional commands, e-mail:
> >[EMAIL PROTECTED]
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>


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

Reply via email to