Results 1 to 2 of 2
- 01-25-2011, 07:15 AM #1
Member
- Join Date
- Sep 2010
- Posts
- 40
- Rep Power
- 0
file locations in Java EE Application
Guys, I am taking this class in Enterprise Java and developing a project using NetBeans. But I am kinda confused because there are 2 folders (ejb and war).
So how do i find out which layer goes in which folder. For example where does the domain, service, business and presentation layer files go respectively?
I know business layers are created as EJB session beans and goes in ejb folder. and the presentation (JSP)goes in war folder. what about domain layers, service layer(factory and other implementation files) and struts files reside? in ejb or war folder?
Also are domain layers created as ejb's or pojo's?
- 05-07-2011, 06:46 PM #2
Member
- Join Date
- May 2011
- Posts
- 6
- Rep Power
- 0
I'd typically separate java and jsp source (some examples):
/src/java/your/packages.../*.java
/src/java/your/packages/actions/*.java
/src/java/your/packages/forms/*.java
/src/java/your/packages/model/*.java
/src/java/your/packages/ejb/*.java
/src/java/your/packages/yourservice/ejb/*.java
Using this naming is easy to build
.war with: **/actions/**, **/forms/** and
-ejb.jar with: **/model/**, **/ejb/**
etc
and jsp (web) source:
/src/jsp/images/
/src/jsp/styleset/
/src/jsp/WEB-INF/*
/src/jsp/WEB-INF/jsp/*.jsp
etc
(rename /src/jsp to /src/web if you want)
The key is when you package (e.g. using ant or maven) the files into:
1) .ear - contains your .war, -ejb.jar, (3rd_party_libraries*).jar, application.xml etc
2) .war - contains your jsp/resource xml files, java source (e.g. struts) and 3rd party libraries visible only to web/servlet container.
3) -ejb.jar - contains java source visible to both web/servlet container and ejb container (e.g. your model, ejbs etc)
The manifest.mf in your -ejb.jar can have a class-path: entry with the list of 3rd party jars packaged in your .ear.
e.g.
struts.jar would typically go into your war
commons-lang.jar would typically go into your .ear and your -ejb.jar would contain a manifest.mf that includes: class-path: commons-lang.jar commons-logging.jar etc (separated by blank space - don't use a comma separator)
Any java class in -ejb.jar should NOT also be duplicated in your war (and vice-versa).
- java classes in -ejb.jar are visible to java classes in .war
- java classes in .war are not visible to java classes in -ejb.jar
Your domain layer would probably be pojo's (or whatever base class you extend)
Your ejb's typically contain business methods/logic managing transactions and invoking your data access layer (daos).
HTH
Similar Threads
-
Help Reading certain Address locations from file.
By kriogenic in forum Java AppletsReplies: 7Last Post: 11-05-2010, 12:45 PM -
calling a jar file from within java application
By robby14 in forum Advanced JavaReplies: 3Last Post: 03-10-2010, 08:11 PM -
Apache Velocity template file and output locations
By mjwoodford in forum New To JavaReplies: 1Last Post: 10-05-2009, 03:59 PM -
How do i create a help file in java for the users of my application
By Manfizy in forum New To JavaReplies: 5Last Post: 08-25-2009, 08:43 AM -
Batch file to Run Java application
By nitishlnt in forum EclipseReplies: 1Last Post: 10-24-2008, 07:46 PM


LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks