But you still call the API from the action right - is this not invoking the
functionality that persists your data?

Seems a bit like semantic juggling to me... (after all the persistance layer
is just an abstraction API on top of writing to db/disk/punchcard itself...)
;-)

I would however agree that there ought to be some sort of abstracting layer
between the view and the implementation specific details of the p-tier...

-----Original Message-----
From: Chappell, Simon P [mailto:[EMAIL PROTECTED]]
Sent: Monday, October 14, 2002 23:04
To: Struts Users Mailing List; [EMAIL PROTECTED]
Subject: RE: DAO or ... ?


You invoke your persistence code in the same place that you would invoke any
other code ... not in the Action!

Write all your core application code (business rules, persistence,
communications etc) in a way that has no connection to the view portion of
your system and then create a API to it. This way you can have any client
you like call into your core code and your core code doesn't need to worry
about what calls it, only about acting upon requests.

Then use the actions to call into the API and pass the API return values to
the JSPs. Works great.

/------\    /---\   /----\
|Client|--> |API|-->|Core|
|Code  |    |   |   |Code|
\------/    \---/   \----/

The API is now your fire break. Nothing on the Core Code side has to worry
about displaying anything and nothing in the Client Code has to worry about
calculating anything.

Simon

-----------------------------------------------------------------
Simon P. Chappell                     [EMAIL PROTECTED]
Java Programming Specialist                      www.landsend.com
Lands' End, Inc.                                   (608) 935-4526


>-----Original Message-----
>From: Andrew Hill [mailto:[EMAIL PROTECTED]]
>Sent: Monday, October 14, 2002 9:57 AM
>To: Struts Users Mailing List
>Subject: RE: DAO or ... ?
>
>
>So where should one invoke the persistance layer?
>
>-----Original Message-----
>From: Lacerda, Wellington (AFIS) [mailto:[EMAIL PROTECTED]]
>Sent: Monday, October 14, 2002 22:51
>To: 'Struts Users Mailing List'
>Subject: RE: DAO or ... ?
>Importance: High
>
>
>Hi Kevin
>
>Avoid persistence in Action code as much as you can.
>
>This is the general recommendation.
>
>Wellington Silva
>Author of "JSP and Tag Libraries for Web Development"
>FAO of the UN - Consultant
>
>-----Original Message-----
>From: Kevin Viet [mailto:[EMAIL PROTECTED]]
>Sent: Monday, October 14, 2002 4:45 PM
>To: struts-user
>Subject: DAO or ... ?
>
>
>My question is a web app design question.
>What pattern you guys follow when you want to save a domain object in
>the database ?:
>
>- use the DAO pattern of java blueprint  (persistence layer is called
>into classes)
>- call to persistence statements into action code :
>
>       // store example
>       try {
>               PeristenceLayer pl = getPerstitenceLayer();
>               pl.save(domainObject);
>       }
>       catch (Exception
>
>
>--
>Kevin Viet <[EMAIL PROTECTED]>
>ActiVia Networks
>
>
>
>
>--
>To unsubscribe, e-mail:
><mailto:[EMAIL PROTECTED]>
>For additional commands, e-mail:
><mailto:[EMAIL PROTECTED]>
>
>
>--
>To unsubscribe, e-mail:
><mailto:[EMAIL PROTECTED]>
>For additional commands, e-mail:
><mailto:[EMAIL PROTECTED]>
>
>
>--
>To unsubscribe, e-mail:
<mailto:[EMAIL PROTECTED]>
For additional commands, e-mail:
<mailto:[EMAIL PROTECTED]>


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


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

Reply via email to