• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

J2EE war structure

 
Ranch Hand
Posts: 43
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I've been at a few jobs, and it's always seem to vary a bit. Is there a standard ("official") way to deploy applications in a war file?

src/
src/com/
src/com/(rest of your .class files)

WEB-INF/
WEB-INF/web.xml
WEB-INF/lib
WEB-INF/lib/(all your jar's here)
WEB-INF/classes
WEB-INF/classes/com/(all your property files here)

test/
test/com/(testing classes)

jsp/
jsp/(all your jsp's here) <---- I've seen all the jsp's in the root path as well

img/ <-- images
js/ <-- javascript
 
Sheriff
Posts: 67748
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Aside from WEB-INF and its sub-folders, the structure is up to you.

Why are you putting source files in the war?
 
Bear Bibeault
Sheriff
Posts: 67748
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
A few other notes:

WEB-INF/classes/com/(all your property files here)


Property files can go anywhere in the classpath that makes sense. What if there's no com package?

jsp/(all your jsp's here) <---- I've seen all the jsp's in the root path as well


All my JSPs go in a folder hierarchy under WEB-INF so that they cannot be directly accessed.
 
Johnny Gara
Ranch Hand
Posts: 43
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Bear Bibeault wrote:Aside from WEB-INF and its sub-folders, the structure is up to you.

Why are you putting source files in the war?



Lol, sorry, posted that late in the day, brain wasn't working.

I was actually thinking of the actual project build directory. So you'd have your source and test files in there as well ;)

in your actual war file, I'd assume you'd only want

js/ <-javascripts
imgs/ <-images
WEB-INF/ <- config files
WEB-INF/lib <- libraries
WEB-INF/jsp <- jsp files (thanks for the tip!)
WEB-INF/classes/com/...etc

 
We can fix it! We just need some baling wire, some WD-40, a bit of duct tape and this tiny ad:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic