Re: VO usage

2004-11-09 Thread Hubert Rabago
As you can see from the responses, you have a variety of options. 
Another option (I guess Niall forgot to mention) is to use your VO
directly.  Declare your VO as the form bean type, and Struts will use
a BeanValidatorForm and wrap it with a WrapDynaBean.  Really, though,
you don't need to be aware of the underlying stuff to start using it. 
When the form is submitted, call the form bean's getInstance() to get
your populated VO (requires the nightly build).  Take note, though,
that there are good reasons to limit a form bean to strings and
boolean fields, so I'd suggest taking a look at both LazyDynaForms and
FormDef.

Hubert

On Tue, 9 Nov 2004 11:48:51 -0500, Patrick Beagan <[EMAIL PROTECTED]> wrote:
> I have an application that uses struts - ejbs - hibernate.  My value
> objects used for hibernate have the exact members as my  html forms.
> Does anyone have
> 
> Any suggestions to re-use these value objects?  IE: It seems that I must
> define an ActionForm for my struts layer, and have a plain value object
> in my app server layer.  I'd rather not duplicate.
> 
> Thanks.
> 
> Patrick
> 
>

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



Re: VO usage

2004-11-09 Thread Struts User
On Tue, 9 Nov 2004 12:45:48 -0500, Robert Taylor <[EMAIL PROTECTED]> wrote:
> Yes. Wendy is absolutely correct.
> Although the I described will work technically,
> you will run into issues as Wendy already mentioned.

I use Robert's approach and make my VO as a JavaBean which only
accepts String and boolean. I validate user input using struts
validator. If a user entered character instead of an integer, struts
validator will catch it and redisplay the error input.

Lee

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



RE: VO usage

2004-11-09 Thread Robert Taylor
Yes. Wendy is absolutely correct. 
Although the I described will work technically,
you will run into issues as Wendy already mentioned.

Sorry, I will think more indepth before responding next time.

robert

> -Original Message-
> From: Robert Taylor [mailto:[EMAIL PROTECTED]
> Sent: Tuesday, November 09, 2004 12:09 PM
> To: Struts Users Mailing List
> Subject: RE: VO usage
> 
> 
> Patrick, you could use DynaActionForms and just have your VO as a property.
> You could unit test your VO's and the ActionForm is just a wrapper. 
> DynaActionForms
> can be defined in your struts-config.xml file thus reducing the number of 
> physical
> objects you have to maintain.
> 
> For updates, you will need some type of ActionForm to enable Struts to bind 
> user input
> to your VO and to leverage the validation framework.
> For reads, you can simply place the VO in the appropriate scope and use JSTL 
> or other
> tags to render its content.
> 
> robert
> 
> > -Original Message-
> > From: Patrick Beagan [mailto:[EMAIL PROTECTED]
> > Sent: Tuesday, November 09, 2004 11:49 AM
> > To: [EMAIL PROTECTED]
> > Subject: VO usage
> > 
> > 
> > I have an application that uses struts - ejbs - hibernate.  My value
> > objects used for hibernate have the exact members as my  html forms.
> > Does anyone have
> > 
> > Any suggestions to re-use these value objects?  IE: It seems that I must
> > define an ActionForm for my struts layer, and have a plain value object
> > in my app server layer.  I'd rather not duplicate.
> > 
> >  
> > 
> > Thanks.
> > 
> > Patrick 
> > 
> >  
> > 
> >  
> > 
> > 
> 
> -
> 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]



Re: VO usage

2004-11-09 Thread Niall Pemberton
You could use lazy DynaBean - I added LazyValidatorForm to Struts a few days
ago - available in the nightly build:

http://svn.apache.org/builds/struts/nightly/

Info:

*
http://struts.apache.org/api/org/apache/struts/validator/LazyValidatorForm.html
* http://www.niallp.pwp.blueyonder.co.uk/#lazydynabean


Alternatively, Hubert Rabago has created the FormDef extension to Struts
which generates the VO for you - exactly what your asking for

https://formdef.dev.java.net/

Niall


- Original Message - 
From: "Patrick Beagan" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Tuesday, November 09, 2004 4:48 PM
Subject: VO usage


I have an application that uses struts - ejbs - hibernate.  My value
objects used for hibernate have the exact members as my  html forms.
Does anyone have

Any suggestions to re-use these value objects?  IE: It seems that I must
define an ActionForm for my struts layer, and have a plain value object
in my app server layer.  I'd rather not duplicate.



Thanks.

Patrick








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



RE: VO usage

2004-11-09 Thread Robert Taylor
Patrick, you could use DynaActionForms and just have your VO as a property.
You could unit test your VO's and the ActionForm is just a wrapper. 
DynaActionForms
can be defined in your struts-config.xml file thus reducing the number of 
physical
objects you have to maintain.

For updates, you will need some type of ActionForm to enable Struts to bind 
user input
to your VO and to leverage the validation framework.
For reads, you can simply place the VO in the appropriate scope and use JSTL or 
other
tags to render its content.

robert

> -Original Message-
> From: Patrick Beagan [mailto:[EMAIL PROTECTED]
> Sent: Tuesday, November 09, 2004 11:49 AM
> To: [EMAIL PROTECTED]
> Subject: VO usage
> 
> 
> I have an application that uses struts - ejbs - hibernate.  My value
> objects used for hibernate have the exact members as my  html forms.
> Does anyone have
> 
> Any suggestions to re-use these value objects?  IE: It seems that I must
> define an ActionForm for my struts layer, and have a plain value object
> in my app server layer.  I'd rather not duplicate.
> 
>  
> 
> Thanks.
> 
> Patrick 
> 
>  
> 
>  
> 
> 

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



Re: VO usage

2004-11-09 Thread Wendy Smoak
From: "Patrick Beagan" <[EMAIL PROTECTED]>
> Any suggestions to re-use these value objects?  IE: It seems that I must
> define an ActionForm for my struts layer, and have a plain value object
> in my app server layer.  I'd rather not duplicate.

While it might seem like a good idea to use the database VO's instead of
making an ActionForm, it's not.  You might have to find that out for
yourself, however. ;)

The first thing that will happen is that you have an integer property in
your VO, and someone puts a character into the field associated with it on
the HTML form.  Now you get an error when populating the VO, and you can't
re-display the "bad" input.  ActionForms should be mostly String, maybe a
Boolean for a checkbox.  VO's should have whatever data types make sense for
the database.

Dynamic forms can help, that's what I use.  Or there are plenty of
code-generation tools that will do it for you.  Either way you should not
have to type in a bunch of get/set methods.

-- 
Wendy Smoak


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