Re: Properties in ActionForms

2001-01-11 Thread martin . cooper

Something I am working on at the moment is a very simple utility that 
generates a form bean from an XML definition. The goal is simply to reduce 
typing in generating beans - as Roger mentioned, it is kinda tedious. I'm 
using something like this to specify a bean:


   
   
   


Pretty simplistic stuff, but it meets my needs right now. If this would be 
of interest to people (and if my company allows it), I can make it 
available when I'm done.

Also, if people have ideas on what it might do differently, or what else it 
might do, I'd be interested in hearing them. And if anyone has a copy of 
the messages from Mark Wutka mentioned in the Struts 1.1 TODO list, I'd 
appreciate it if they could forward them to me.

Thanks!

--
Martin Cooper
Tumbleweed Communications


At 10:12 AM 1/11/01 -0800, you wrote:
>Roger Kjensrud wrote:
>
> > Hello,
> >
> > I wonder if any of you have implemented an automatic way of populating the
> > properties in the ActionForm? It's kind of tedious to write all these 
> setter
> > and getter methods
> >
>
>For generating the code of a form bean automatically, that is something I want
>to look at in the 1.1 time frame.  As well, we need to look at use cases where
>you do not know the property names ahead of time, and need them to work 
>totally
>dynamically.
>
>For populating the properties, if you are trying to copy things from a 
>"business
>logic" bean that has the same property names, consider the
>PropertyUtils.copyProperties() method.
>
> >
> > I found an
> > article(http://www.javaworld.com/javaworld/jw-12-2000/jw-1201-struts.html)
> > describing one way of doing this, and I would be interested in hearing some
> > feedback on doing it that way.
> >
> > Thanks,
> > Roger Kjensrud
>
>Craig McClanahan





Re: Properties in ActionForms

2001-01-11 Thread Craig R. McClanahan

Oleg V Alexeev wrote:

> Hello Ted,
>
> In my application I use import/export methods in Form classes. For the
> first time I try to use PropertyUtils.copyProperties(), but this
> method convert properties without locale choosing. I need to process
> different time/date and number formats for different languages.
> Because of it I use my own methods to convert values to String and
> from String to values.
> I think that locale must be used to convert values in
> PropertyUtils.copyProperties() and in  tag.
> If anybody can suggest another way, plesase, I am very interested in
> it.
>

We're talking futures in terms of Struts here, but my question is ... aren't you
doing the Locale-specific conversion a little bit too early?

My thinking is that business logic objects maintain data objects in a
Locale-insensitive format (like java.util.GregorianCalendar or
java.math.BigDecimal).  And, the ActionForm properties would be of the same
type.  Conversion to or from String would happen at the last minute -- just as
you prepare the page for display, or as you are accepting the input.

Admittedly, we need better support in Struts (such as your formatting version of
, and a way to process the input string with PropertyEditor type
classes) to make this strategy really effective, but I would suggest not doing
the Locale-specific formatting until you have to.

Craig





Re: Properties in ActionForms

2001-01-11 Thread Ted Husted

>I wonder if any of you have implemented an automatic way of populating
the properties in the ActionForm? 

Doing more with "auto beans" is being discussed for the 1.1 timefreame.
Meanwhile, the latest builds support the next best thing: You can
define generic data beans for your business logic data, and then make
these instance variables on your action forms. The HTML form tags now
support a nested syntax like this:
  
  
  
and the appropriate processing will be applied to get the street
address (for initial display) and set the street address (when the form
is processed).

Of course, you still have to define the accessor and mutators for your
generic data beans, but it's a step in the right direction!

*** REPLY SEPARATOR  ***

On 1/11/2001 at 9:39 AM Roger Kjensrud wrote:

Hello,

I wonder if any of you have implemented an automatic way of populating
the
properties in the ActionForm? It's kind of tedious to write all these
setter
and getter methods

I found an
article(http://www.javaworld.com/javaworld/jw-12-2000/jw-1201-struts.htm
l)
describing one way of doing this, and I would be interested in hearing
some
feedback on doing it that way.

Thanks,
Roger Kjensrud






Re: Properties in ActionForms

2001-01-11 Thread Craig R. McClanahan

Roger Kjensrud wrote:

> Hello,
>
> I wonder if any of you have implemented an automatic way of populating the
> properties in the ActionForm? It's kind of tedious to write all these setter
> and getter methods
>

For generating the code of a form bean automatically, that is something I want
to look at in the 1.1 time frame.  As well, we need to look at use cases where
you do not know the property names ahead of time, and need them to work totally
dynamically.

For populating the properties, if you are trying to copy things from a "business
logic" bean that has the same property names, consider the
PropertyUtils.copyProperties() method.

>
> I found an
> article(http://www.javaworld.com/javaworld/jw-12-2000/jw-1201-struts.html)
> describing one way of doing this, and I would be interested in hearing some
> feedback on doing it that way.
>
> Thanks,
> Roger Kjensrud

Craig McClanahan





RE: Properties in ActionForms

2001-01-11 Thread Schachter, Michael

Roger,

Although I can't think of any immediate implementations, this issue will be
actively addressed in 1.1, as noted on the TODO list:

http://jakarta.apache.org/cvsweb/index.cgi/jakarta-struts/src/doc/todo-1.1.x
ml

My current personal feeling on this matter is that form arguments should
possibly be tied a little closer to an underlying data model, making action
processing a little more protocol neutral.  But thats a whole different
story for now.

-Original Message-
From: Roger Kjensrud [mailto:[EMAIL PROTECTED]]
Sent: Thursday, January 11, 2001 12:40 PM
To: [EMAIL PROTECTED]
Subject: Properties in ActionForms


Hello,

I wonder if any of you have implemented an automatic way of populating the
properties in the ActionForm? It's kind of tedious to write all these setter
and getter methods

I found an
article(http://www.javaworld.com/javaworld/jw-12-2000/jw-1201-struts.html)
describing one way of doing this, and I would be interested in hearing some
feedback on doing it that way.

Thanks,
Roger Kjensrud