This week's book giveaway is in the Jobs Discussion forum.
We're giving away four copies of Java Interview Guide and have Anthony DePalma on-line!
See this thread for details.
The moose likes Struts and the fly likes Struts Question Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Java Interview Guide this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Struts Question" Watch "Struts Question" New topic

Struts Question

Saikiran Madhavan

Joined: May 15, 2006
Posts: 28

I am not sure whether i can put this question in this section.But still i didnt found any new topic for Struts, so i am putting this question with this section.

I am starting a project with Struts Framework (1.2). I just want to know how to use design patterns like VO, DAO in it.

I understand design patterns, but i didnt implemented any of them still...can anyone point out some useful link which has complete or partly implementation of these patterns with Struts...

Brent Sterling
Ranch Hand

Joined: Feb 08, 2006
Posts: 948
It seems like a valid question for this forum. I have two general comments on this. First off, I would not recommend implementing design patterns just for the sake of implementing design patterns. Certain patterns, such as the DAO pattern, are useful in a number of situations but you should let your technology, architecture and requirements drive the patterns that you use.

As far as "implementation of these patterns with Struts", Struts is a presentation layer framework. You mention the DAO and VO patterns. These patterns are more data and business layers patterns. While they can be used in architecture along side Struts, they are not related to Struts and you would not implement them with Struts. Struts is generally viewed as an implementation of the MVC pattern.

- Brent
Merrill Higginson
Ranch Hand

Joined: Feb 15, 2005
Posts: 4864
There's nothing special to know about using J2EE patterns in a Struts applications. Struts assumes you will write your own model classes, and it's entirely up to you how you write them. Once you have written your model classes, it is your Action class that will instantiate them and call methods on them to do the actual work of the application.

So, for example, if you know how to create an object that follows the Data Access Object (DAO) pattern, go ahead and create one. Then instantiate it in your Action class and use it to do the work of your application.

Consultant, Sima Solutions
I agree. Here's the link:
subject: Struts Question
It's not a secret anymore!