Hi friends,
After a long discussion about the above subject - I found a related
article, which was very interesting for me (as new to Struts) and I
would like to forward it to you and will be happy to read your comments
to it.
It's called Struts Live Chapter: Nested POJOs and you can find
Laurie Harper wrote the following on 7/12/2005 8:25 PM:
Rick Reumann wrote:
(By the way I pass in an optional default format in my constructor as
shown above, but my converters have a setFormatPattern(..) method that
can change the format at any time)
Don't you end up with thread safety
On 7/11/05, Nitish Kumar [EMAIL PROTECTED] wrote:
This is a HUGE problem with BeanUtils and why I end up having to
register custom converters:(
good point, but where do I register my custom converters? I dont want to do
it in my action classes, and writing a plugin just to register my
On 7/11/05, Borislav Sabev [EMAIL PROTECTED] wrote:
Rick Reumann wrote:
You shouldn't want a default at all provided by BeanUtils for cases
where it can be null! You are using the anomoly of the way Integer is
working and wanting to propogate that poor solution. null should be
null..
-
From: Craig McClanahan [mailto:[EMAIL PROTECTED]
Sent: Tuesday, July 12, 2005 8:06 AM
To: Struts Users Mailing List
Subject: Re: Using struts forms as Value Objects: your opinion?
On 7/11/05, Rivka Shisman [EMAIL PROTECTED] wrote:
Hi guys,
Borislav - thank you for the time you spent debugging
Nitish Kumar wrote:
This is a HUGE problem with BeanUtils and why I end up having to
register custom converters:(
good point, but where do I register my custom converters? I dont want to do
it in my action classes, and writing a plugin just to register my converters
would be a big overhead.
On 7/12/05, Rivka Shisman [EMAIL PROTECTED] wrote:
Hi Craig
I understand that you did not follow this thread from the beginning.
As I mentioned before - when working with int, short, byte types - my
app works fine. I don't get any runtime exception!
If you are not getting an exception in
Craig McClanahan wrote:
Blame backwards compatibility. By the time this issue was raised,
there were huge numbers of applications already dependent on the
previous behavior, which would have been broken by a change.
However, this shouldn't have *any* impact on incorrect values in
forms. If
Rivka Shisman wrote:
Is it crucial for the Action Form to have String properties?
Yes.
Http/html is a String protocol. A user types in a string in your forms
(unless it's a callendar tag for dates)
rambles on:
Only exception is if you have R/O, only getters, that you would not even
In JDNC, it's all native... (collections in my case)
...and what JDNC is?
-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
In my experience, maps can be better when the database is driving.
When the purpose of the application is to expose the database, then
most of the map attributes can correspond directly to database fields.
You can also use the same tokens. If the database calls the fact
birth_date, then the fact
Ted Husted wrote:
In my experience, there's at least two best practices for every
problem. Sometimes you waterfall, and sometimes you agile. Sometimes
you hibernate, sometimes you ibatis. Sometimes, you property, and
sometimes you map.
One-size-fits-all is the pointy-hair grail :)
Is it crucial for the Action Form to have String properties?
Five years of history with Struts (and I should know, since I
created it originally) says yes :-)
I think it's reasonable to have a numeric type for select-box.
- Dave
Borislav Sabev wrote the following on 7/12/2005 3:20 AM:
In fact I'm a bit confused what exactly is the recommended design
pattern in this case ...
My conclusion is really to use Strings,
Yes, you should use Strings in your ActionForms. Then you have your
business object POJO with the
Durham David R Jr Ctr 805 CSPTS/SCE wrote the following on 7/12/2005
10:09 AM:
Is it crucial for the Action Form to have String properties?
Five years of history with Struts (and I should know, since I
created it originally) says yes :-)
I think it's reasonable to have a numeric type for
Rivka Shisman wrote the following on 7/12/2005 3:22 AM:
I understand that you did not follow this thread from the beginning.
As I mentioned before - when working with int, short, byte types - my
app works fine. I don't get any runtime exception!
I don't think you tried what Craig proposed.
Rick Reumann wrote:
Borislav Sabev wrote the following on 7/12/2005 3:20 AM:
In fact I'm a bit confused what exactly is the recommended design
pattern in this case ...
My conclusion is really to use Strings,
Yes, you should use Strings in your ActionForms. Then you have your
business
Rick Reumann wrote:
(By the way I pass in an optional default format in my constructor as
shown above, but my converters have a setFormatPattern(..) method that
can change the format at any time)
Don't you end up with thread safety issues calling setFormatPattern()
though? I would want to
Rivka Shisman wrote:
Hi Erik
You said - My form class fields are always Strings (because of HTTP)
- I'm not sure I anderstand the meaning of this - why do the fields are
Strings?
I have recently started working with struts and my forms contain int,
short, boolean and so on, and it works
Hi again
When you say that validation doesn't work when inserting ABC in an
integer field - do you mean when using struts Validator?
I'm not using the Validator - I just add if myInteger 1 in method
validate().
If I define myInteger as String - how do I check that it's a valid
number in the
Rivka Shisman wrote:
Hi again
When you say that validation doesn't work when inserting ABC in an
integer field - do you mean when using struts Validator?
I'm not using the Validator - I just add if myInteger 1 in method
validate().
If I define myInteger as String - how do I check that it's
Hi again
When you say that validation doesn't work when inserting ABC in an
integer field - do you mean when using struts Validator?
I'm not using the Validator - I just add if myInteger 1 in method
validate().
If I define myInteger as String - how do I check that it's a valid
number in the
Raghavendra.E
--
Programmer Analyst
-Original Message-
From: Rivka Shisman [mailto:[EMAIL PROTECTED]
Sent: Monday, July 11, 2005 3:36 PM
To: Struts Users Mailing List
Subject: RE: Using struts forms as Value Objects: your opinion?
Hi again
When you say that validation
-Original Message-
From: Borislav Sabev [mailto:[EMAIL PROTECTED]
Sent: Monday, July 11, 2005 11:27 AM
To: Struts Users Mailing List
Subject: Re: Using struts forms as Value Objects: your opinion?
Rivka Shisman wrote:
Hi again
When you say that validation doesn't work when inserting ABC
Rivka Shisman wrote:
Hi Borislav
I did the test and it works fine -
In my form I have:
private int question_no;
public void setQuestion_no(int i) {
this.question_no = i;
}
public int getQuestion_no() {
return question_no;
}
public ActionErrors validate(ActionMapping mapping,
Shisman [mailto:[EMAIL PROTECTED]
Sent: Monday, July 11, 2005 5:13 PM
To: Struts Users Mailing List
Subject: RE: Using struts forms as Value Objects: your opinion?
Hi Borislav
I did the test and it works fine -
In my form I have:
private int question_no;
public void setQuestion_no(int i
On 7/8/05, Craig McClanahan [EMAIL PROTECTED] wrote:
+1 as well, and this matches the historical reason that form beans
were invented in the first place.
Form beans are part of the *view* tier, not the model ... their
purpose in life is to represent the server side state of the HTML
Nitish Kumar wrote:
I think raghavendra is right.
Rivka, your code is working because you are using primitive type int and not
the wrapper type Integer.
In case of primitive type in case of any exception, it gives you a default
value.
Thanks and Regards,
Nitish Kumar
I don't think
Ted Husted wrote:
In my own work, I tend to think of an enterprise-grade application as
a set of overlapping rings, like the Olympics logo.
* http://www.olympic.org/
In the Blue ring...
Nice analogy! :-)
--
Laurie, Open Source advocate, Java geek and novice blogger:
Auftrag von Laurie Harper
Gesendet: Montag, 11. Juli 2005 18:31
An: user@struts.apache.org
Betreff: Re: Using struts forms as Value Objects: your opinion?
Ted Husted wrote:
In my own work, I tend to think of an enterprise-grade
application as
a set of overlapping rings, like the Olympics
Auftrag von Laurie Harper
Gesendet: Montag, 11. Juli 2005 18:31
An: user@struts.apache.org
Betreff: Re: Using struts forms as Value Objects: your opinion?
Ted Husted wrote:
In my own work, I tend to think of an enterprise-grade
application as
a set of overlapping rings, like the Olympics
On 7/7/05, Laurie Harper [EMAIL PROTECTED] wrote:
Personally I prefer to keep form beans and value objects seperate, for two
key reasons:
1) form beans generally should consist of String data to facilitate
round-tripping of invalid inputs. I like to constrain them to a clearly
defined role
There's probably something to that, Leon.
Of course, there's nothing new here, except maybe the metaphor. Using
the layers pattern in enteprise applications is well known. I believe
Bushman describes it in POSA. Here's another online treatment:
* http://www.stevenblack.com/PTN-Layers.asp
-Ted.
On 7/11/05, Michael Jouravlev [EMAIL PROTECTED] wrote:
JSF still differentiates real object (whatever it might be, a real
business object or a VO) from visual component data, which I don't
like. From my point of view, it is much easier to have an object with
an ID, to view/edit it, or to
Nitish Kumar wrote:
I think raghavendra is right.
Rivka, your code is working because you are using primitive type int and not
the wrapper type Integer.
In case of primitive type in case of any exception, it gives you a default
value.
Thanks and Regards,
Nitish Kumar
So after small
Borislav Sabev wrote the following on 7/11/2005 1:37 PM:
In case of the Integer there is pre-load default value and EVEN if
conversion fails during the population phase, it just use is the dafault
value (and you think it's parsed correctly). In the previous example its
a coincidence that
of course... I use Collections (Maps and Lists) as VO/DTO.
You can wrap them w/ DynaMaps, you can validate a map, you don't have to
maintain deprecated gets/sets, it reduces duplication... your dao
can return a map/collection/list...
I think it vastly simplifies to use Maps in places
netsql wrote the following on 7/11/2005 2:15 PM:
I think it vastly simplifies to use Maps in places where I used to use
beans. (I even got rid of baseBeans domain how much I loved maps)
Vic I think you sleep with the Map API under your pillow at night or use
it as a Teddy Bear when you
Hmm, of course, who needs things like refactoring, and compile time
name and type checking? That's why you have users, eh? They'll find
the bugs eventually. ;-)
Larry
On 7/11/05, netsql [EMAIL PROTECTED] wrote:
of course... I use Collections (Maps and Lists) as VO/DTO.
You can wrap them w/
Rick Reumann wrote:
How does a developer working on your
code know how to even get the properties out of your Map? I guess he has
to look at some API contract saying put date of birth in the Map as
dob not dateOfBirth.
As in iBatis, name of the map property is in my case the field name in
Larry Meadors wrote:
Hmm, of course, who needs things like refactoring, and compile time
name and type checking? That's why you have users, eh? They'll find
the bugs eventually. ;-)
Larry
Get/Set, Get/Set Half the time I have no idea what the db date will
come back as.
Look, I think
It's ironic to me that I had this same discussion with someone at work
just last week :)
I *was* in the Maps are better camp until a few months back when I
changed my mind, and it comes down to one thing:
Self-documenting code is better.
A bean is self-documenting in that you can
netsql wrote the following on 7/11/2005 3:25 PM:
Rick Reumann wrote:
How does a developer working on your
code know how to even get the properties out of your Map? I guess he
has to look at some API contract saying put date of birth in the Map
as dob not dateOfBirth.
As in iBatis, name of
Frank W. Zammetti wrote the following on 7/11/2005 3:48 PM:
A bean is self-documenting in that you can immediately tell what its
attributes are and what types they are. I'm not even talking about
generating javadoc from the source either, but that's certainly a very
nice by-product.
amen:)
the layout of the domain model on the
server- Original Message -
From: Rick Reumann [EMAIL PROTECTED]
To: Struts Users Mailing List user@struts.apache.org
Sent: Monday, July 11, 2005 2:56 PM
Subject: Re: Using struts forms as Value Objects: your opinion?
netsql wrote the following on 7/11
Rick Reumann wrote:
But also remember it's not just about how nice it is to find out the
types and names of the properties. Using Maps can introduce a lot of
hidden bugs that are difficult to track down (mentioned just a few in
last e-mail)
Ditto :)
(That's my Patrick Swayze moment for the
netsql wrote the following on 7/11/2005 3:36 PM:
Most of the sucessfull p-langs are dynamic. In flash, array and map are
same class even. I envy their sucess. For example, the home page of
Spring is done in Plone.
Vic, I love you man, but coming back with what Flash or some other
On 7/11/05, Frank W. Zammetti [EMAIL PROTECTED] wrote:
A bean is self-documenting in that you can immediately tell what its
attributes are and what types they are. I'm not even talking about
generating javadoc from the source either, but that's certainly a very
nice by-product.
If I could
Frank W. Zammetti wrote the following on 7/11/2005 4:00 PM:
Ditto :)
(That's my Patrick Swayze moment for the day)
awhhh shucks, I thought you were a Rush Ditto-head for a moment:)
See I labeled this thread [FRIDAY] - I didn't want the sruts-list users
police showing up
(just messin
Rick Reumann wrote:
They have to look at a database model in order to figure
out how to get back a dateOfBirth field?
Yup. Each develolper has a 24 poster of the data model. DBA is in
charge, Model Driven. Just like client server days.
Now
they want to iterate over this list and display
netsql wrote the following on 7/11/2005 4:20 PM:
Realy Rick, please try Groovy... it's the answer that's looking for you.
I am sure you have read some of the Rails press.
Actually, Groovy is one of the things I do want to take a look at.
Hopefully one of these days I'll get to it:)
--
Rick Reumann wrote:
Call me stupid but I don't
even know what p-langs are (languages I can urinate on?:)
lol.
PHP (Friendster tried J2EE, went to PHP). Part of LAMP stack, conisdered
most effective. Try Tiki-Wiki or Drupal when you get a project, you are
80% done.
Python (used by
W/ a Map:
- you don't have VO/DTO classes, but still have layer, 0 code, 0 bugs
- It's dynamic, when DAO SQL string changes... so does your
jxTable/Displaytag.
I removed an entire layer and still have the layer.
Developers are so pasionate... that's what makes them good.
I'm with you on
Yeah, that's a fair point, it is a bit more documenting than it probably
could be... then again, all modern IDEs will do it for you, right? And
I even have my UltraEdit macros to do it. Still, fair point.
Having not looked into it very much, does annotations in 1.5 help at all
in this
I don't see how enabling BO/VO to read stringified data makes them
dependant on Struts packages.
On 7/8/05, Bill Schneider [EMAIL PROTECTED] wrote:
Well put. To expand on #2, it's good to confine dependencies on the
org.apache.struts packages to the presentation layer, and not build a
Struts
Michael Jouravlev wrote:
On 7/7/05, Laurie Harper [EMAIL PROTECTED] wrote:
Is not it easier to have one nested VO/BO with string properties, than
to copy properties back and forth from action form to VO? I use web
framework only to expose my real objects to the outer world.
If you don't
On 7/11/05, Laurie Harper [EMAIL PROTECTED] wrote:
Most of my validation is handled by the Validator framework right now
which, admitedly, ties things to Struts to some extent (though there's no
reason I couldn't pull Validator 'down' a level and use it under some other
presentation
List
Subject: Re: Using struts forms as Value Objects: your opinion?
Borislav Sabev wrote the following on 7/11/2005 1:37 PM:
In case of the Integer there is pre-load default value and EVEN if
conversion fails during the population phase, it just use is the dafault
value (and you think it's
missing something here?
Thanks
Rivka
-Original Message-
From: Borislav Sabev [mailto:[EMAIL PROTECTED]
Sent: Monday, July 11, 2005 7:38 PM
To: Struts Users Mailing List
Subject: Re: Using struts forms as Value Objects: your opinion?
Nitish Kumar wrote:
I think raghavendra is right
with that?
Rivka
-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
Sent: Friday, July 08, 2005 1:33 AM
To: Struts Users Mailing List
Subject: Re: Using struts forms as Value Objects: your opinion?
An alternative would be to have your form class extend your value object
From: Rivka Shisman [EMAIL PROTECTED]
I have recently started working with struts and my forms contain int,
short, boolean and so on, and it works fine.
So far... but what happens when you display a text field asking for an
integer, and your user types 'ABC'?
It may not be a problem in
Vincent wrote:
I'm currently designing and developping an enterprise J2EE application
based on Struts.
In this application there's a layer of Data Access Object which abstract
the underlying persistent storage.
For populating my struts' *Form I've imagined first a transfert between
forms and
1) form beans generally should consist of String data to facilitate
round-tripping of invalid inputs. I like to constrain them to a clearly
defined role of marshaling data 'into' and 'out of' the
presentation layer,
i.e. across the boundary between presentation and application.
This i would
On 7/8/05, Laurie Harper [EMAIL PROTECTED] wrote:
Personally I prefer to keep form beans and value objects seperate, for two
key reasons:
+1 == me too.
-T.
-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands,
Well put. To expand on #2, it's good to confine dependencies on the
org.apache.struts packages to the presentation layer, and not build a
Struts dependency into business logic.
Personally I prefer to keep form beans and value objects seperate, for
two key reasons:
1) form beans generally
On 7/7/05, Laurie Harper [EMAIL PROTECTED] wrote:
Vincent wrote:
What do you thing about using forms as VO? Do you think it's a dirty
solution? Forms are often mirrors of the database's table.
Personally I prefer to keep form beans and value objects seperate, for two
key reasons:
+1
Hi,
I'm currently designing and developping an enterprise J2EE application
based on Struts.
In this application there's a layer of Data Access Object which abstract
the underlying persistent storage.
For populating my struts' *Form I've imagined first a transfert between
forms and DAO based
:[EMAIL PROTECTED] Im Auftrag von Vincent
Gesendet: Freitag, 8. Juli 2005 01:15
An: user@struts.apache.org
Betreff: Using struts forms as Value Objects: your opinion?
Hi,
I'm currently designing and developping an enterprise J2EE
application based on Struts.
In this application there's
:[EMAIL PROTECTED] Im Auftrag von Vincent
Gesendet: Freitag, 8. Juli 2005 01:15
An: user@struts.apache.org
Betreff: Using struts forms as Value Objects: your opinion?
Hi,
I'm currently designing and developping an enterprise J2EE
application based on Struts.
In this application there's
@struts.apache.org
Subject: Using struts forms as Value Objects: your opinion?
Hi,
I'm currently designing and developping an enterprise J2EE application
based on Struts.
In this application there's a layer of Data Access Object which abstract
the underlying persistent storage.
For populating my struts' *Form
want. You can
go a step further and create value object classes based on database metadata .
. .
Erik
-Original Message-
From: [EMAIL PROTECTED]
Sent: Jul 7, 2005 7:33 PM
To: Struts Users Mailing List user@struts.apache.org
Subject: Re: Using struts forms as Value Objects: your opinion
On 7/7/05, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote:
An alternative would be to have your form class extend
your value object class. However, this approach doesn't
work for me. My form class fields are always Strings
(because of HTTP), while my value object fields are
whatever types make
I usually build my ActionForm classes with the VO on it as a property.
The String properties can be just refered to as bean.property on the jsp.
Any non-string properties I map to the bean in the action form, with
the translation - so if there is a date, for instance, the property on
the action
: Jul 7, 2005 8:16 PM
To: Struts Users Mailing List user@struts.apache.org, [EMAIL PROTECTED]
Subject: Re: Using struts forms as Value Objects: your opinion?
On 7/7/05, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote:
An alternative would be to have your form class extend
your value object class. However
Vincent,
Before you go this route, check out FormDef plugin first.
http://formdef.dev.java.net
It will register Struts forms based on your VOs. There are several
reasons why you shouldn't use VOs as your form beans and vice versa
(as other msgs in this thread explain). FormDef would allow you
Hubert Rabago wrote the following on 7/8/2005 12:24 AM:
There are several
reasons why you shouldn't use VOs as your form beans and vice versa
(as other msgs in this thread explain).
Actually in this thread so far I haven't heard anyone explain why they
are a 'bad' idea. The only way I see
76 matches
Mail list logo