This is kind of a trick question, or at least a trick subject.

In a Struts application, the best practice for database access is for Struts to be 
unaware that there is even such a thing as a database. If you are using the Struts 
best practice, then it shouldn't matter whether the database example is in a Struts 
application or not.

The Struts Mailreader demonstrates an excellent practice for database access. It 
defines an POJO interface with the methods that accept and/or return the data that the 
application needs. The Actions expect that singleton instances of these plain-old Java 
objects will be in application scope under a known name. The Actions speak only to the 
interface. A Struts PlugIn loads an implementation of the interfaces into application 
scope under the expected names, and we are ready to rock.

The POJO JavaBeans can be implemented using whatever technology you like. They should 
not know there are living in a Struts application, or even a Web application, and 
should be fully testable. You should be able to write them using stock examples for 
your chosen technology, blissfully unaware of whether they will be used by Struts or 
not.

-Ted.

On Thu, 15 Jul 2004 14:16:29 +0800, Richard Reyes wrote:
> Hi Guys,
>
> Newbie question, where can i get struts sample application using
> database components like DAO, JDO or Hibernate samples.
>
> Thanks
> Richard



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

Reply via email to