web apps & directory layout

When servlet spec first appeared there was a trend to maintain web app sources in the same manner as any other non-web java app (bin-src layout pattern, etc. ). Then build process, usually ant, assembled war file by placing classes, libs, web.xml in appropriate places and zipping all together. Even ant war task seems to encourage this ANTI-PATTERN. I never use that task because…

Web app sources should be maintained in a layout as close to real deployment structure as possible. So, web.xml is kept in WEB-INF, compiled java code in WEB-INF/classes and so on. Why?

  • Main motivation is that it’s so easy to setup the proper web development environment with goodies like: java hot-swap, instantly visible changes to view layer (html, jsp, vm or whatever), etc. Just tell server to look for web app at the source files’ location. It’s usually simple addition to server configuration file or something more fancy like tomcat’s context files.
  • Ant scripts that build wars are smaller and easier to understand. They jar folder as-is. No hidden magic added.
  • It’s just simpler – source layout reflects contents of war. When I look at unpackaged war file on server I know exactly where to look for those files in code-base (and vice versa).

All above advocate productive (java) web development. Productive means that when I change java/html/jsp/vm I don’t have to run any ant scripts and/or restart web server to see my change working. Keeping web app source structure conforming to servlet spec is a first step towards productivity.

4 Responses to web apps & directory layout

  1. click through the next website

    web apps & directory layout | monkey island

  2. football says:

    In day to day life, the well known football players are becoming a role model to motivate the youths.

    Do you wear your own football package when actively playing
    football along with friends on the park or even wear your shirt casually around town or perhaps is this your ritual to wear your groups colors when going down to the pub.

    A further way to get far better lines with on-line sports activities betting is diminished juice.

  3. I do not even know how I stopped up right here, but I
    assumed this submit used to be good. I do not recognize who you are however definitely you are going to a famous blogger in case you aren’t already.

  4. If you would like to get much from this paragraph then you have to apply these strategies to your won webpage.

%d bloggers like this: