File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Struts and the fly likes Package structure in Struts Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Package structure in Struts" Watch "Package structure in Struts" New topic

Package structure in Struts

Clifford Adams
Ranch Hand

Joined: May 12, 2004
Posts: 50
I'm looking for some best practice advice here. I am starting on my first Struts project of any substance. Previously I have always had everything in the same package: formbeans, actions, utility classes, and other beans. I am thinking that if all of these files are in the same package, it's going to be a pain to find one in particular.

So does it make sense to have seperate packages for beans, actions, utilities, etc? Does this pose any problems or headaches?

Sheldon Fernandes
Ranch Hand

Joined: Aug 18, 2004
Posts: 157
Packaging is important, especially in big projects. Even in small projects, it makes sense to package classes.

How you choose to package classes is however a matter of debate.
- The conventional approach would be as you have thought "seperate packages for beans, actions, utilities".
- However some people advocate packaging as per functionality rather than type of classes.

In any case, I have not faced any problems/headaches because of packaging.
Peter Laurinec
Ranch Hand

Joined: Sep 13, 2004
Posts: 52
Yap thanx for you answer.
I know that its hard and anyone can have and like his own convention but why to reinvent the wheel again ?
Can anyone post here some example that he uses/found somewhere and thinks its quite a good way how to dont get lost.


SCJP 1.5 (done, at last)<br /> <br />"If everything seems to be going well you have obviously overlooked something."
I agree. Here's the link:
subject: Package structure in Struts
It's not a secret anymore!