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 ?

Chears.
<--
Alexandre Jaquet
->
-----BEGIN GEEK CODE BLOCK-----
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*
------END GEEK CODE BLOCK------

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


Hi,
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
through
service layer..

So in action classes u get Instance of appropriate service from service
factory
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
used
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
delegate
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
form
beans and the action just has to cast the form bean to appropiate type and
call
getBean or beanList as the case may be..

And as u said, the most important part is how we handle conversion of data
from
primitives to string and vice versa.On form bean, all beans are
StringBeans...So for each ValueBean we have a corresdpondign String
bean..And
the StringBEan has a method getBean which returns the corresponding
valueBean
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
all
the conversion methods...

The most important part is we use CodeGeneration using XSLT to create the
value
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
and
action classes to delegate...

Hope this is not too lengthy or confusing...I know there are some issues
like
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
tests...

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

hope this helps,
regards,
Shirish

-----Original Message-----
From: pat.quinn2009 [mailto:[EMAIL PROTECTED]]
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
etc..


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.

Cheers,

Guys






_________________________________________________________________
Add photos to your messages with MSN 8. Get 2 months FREE*.
http://join.msn.com/?page=features/featuredemail


--
To unsubscribe, e-mail:
<mailto:[EMAIL PROTECTED]>
For additional commands, e-mail:
<mailto:[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