struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "alexj" <>
Subject Re: Design Patterns/Examples
Date Wed, 29 Jan 2003 08:54:39 GMT
Hi ,

I read your post and I think is pretty interesting as you say you
can send sample code.

May you send me at this adresse some code sample ?

Alexandre Jaquet
Version: 3.12
GCM d+ s: a-- C++++ U*+ P L--- E--- W+++ N+++ o K---- w+++++
O---- M-- V-- PS+++ PE+++ Y+++ PGP--- 5-- X++++ R* tv b++++ DI--- D----
G++ e* h++ r% y*

----- Original Message -----
From: <>
To: <>
Sent: Wednesday, January 29, 2003 9:48 AM
Subject: RE: Design Patterns/Examples

We have used folowing approach..

To access db , we use DAO pattern(refer to Sun's blue prints for more
details).The DAOs return value objects And all calls to the DAO must go
service layer..

So in action classes u get Instance of appropriate service from service
and call the corresponding method..So all the data base access logic  and
conversion of result set to u r value beans is in service layer.(We have
converter classer for the same..One converter per Value bean...)
Also as service factory is used, u can pretty much change ur servie
implementation with out afecting the struts layer.

So on struts side ,the action clsses are pretty much simple .They just
the request.
In action, we get the data from request.And validate the data and if any
validation errors, send back to the user.Each form contains value beans as
thier attributes.So the data from jsps is automatically populated in the
beans and the action just has to cast the form bean to appropiate type and
getBean or beanList as the case may be..

And as u said, the most important part is how we handle conversion of data
primitives to string and vice versa.On form bean, all beans are
StringBeans...So for each ValueBean we have a corresdpondign String
the StringBEan has a method getBean which returns the corresponding
after performing the conversions from String to primitive type.Similarly on
each ValueBEan we have a getStringBEan which performs the conversion from
primitive to String type.And we have a Utility class ParsingUtils which has
the conversion methods...

The most important part is we use CodeGeneration using XSLT to create the
BEans,DAOs,COnverters for value beans and the String beans.And for the code
generation , we use an XML which describes which StroedProc is caled and the
field names etc etc.So all this conversion methods (getStringBean and
getBean)are also auto generated.And as we have utility methoda in
PArsingUtils,this is nto at all difficult.So we dont spend any time at all
coding data conversion or data access layer.All we need to do is write jsps
action classes to delegate...

Hope this is not too lengthy or confusing...I know there are some issues
too many Objects are  created(for each bean, a correspondign string bean is
created etc etc..)but we have found a satisfactory performance for our load

If any body s interrested, i can give sample code for code generation as

hope this helps,

-----Original Message-----
From: pat.quinn2009 []
Sent: Tuesday, January 28, 2003 9:21 PM
To: struts-user
Subject: Design Patterns/Examples

Hi Guys,

Any one know of some design patterns or examples i could use with struts. I
want to access a database(Value Objects) allow the user to change the VO
data, perform some business validation and update the database. I'd like
some pointers also when working with form beans and vo object whats the best
way to transfer data between them... should i use vo's as instance variable
instead form bean... if so how will i handle java primitives like double's

I'm not looking for the answers to all the above but i'd like to review a
pattern or example which demonstrates the best approach for the above.

I have my own ideas but would like to look over some design
patterns/examples before commencing this work.



Add photos to your messages with MSN 8. Get 2 months FREE*.

To unsubscribe, e-mail:
For additional commands, e-mail:

To unsubscribe, e-mail:
For additional commands, e-mail:

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message