Search code examples
javajakarta-eeextjsextjs4extjs-mvc

folder structure to be used for an application with extjs and java?


I have created a Java Project wherein I am using ExtJS for the web pages and I should be using Java for the programming logic. Right now,I am able to display the web pages. However, I do not have any java files and my current folder structure is:

ext_java_proj

  • src
  • jre system library
  • apache tomcat v7.0
  • build
  • WebContent

    • com
      • controller
      • model
      • store
      • view
        • BorderLayout.js
    • ext_js
      • resources
      • src
      • ext_all.js
    • index.html

    Can someone tell me if I should place my java files in src folder or I should place it within the WebContent>com folder. And which is the best practice if it is a relatively big project with lot of java files and js files.

Thanks in advance.


Solution

  • Java files should be kept in src folder. You shouldn't put any java code inside Webcontent folder as it is accessible to the client. The reason why we keep Javascript/ExtJS files in Webcontent is that these files should be accessible to the end user.

    Note: Build tools read java classes from src folder convert them into classes and put them in WEB-INF folder which will never be accessible to the client. Structure of src folder depends on the build tools. If you are using eclipse (since it uses ant) you keep your java files directly in src folder. In case of maven you should keep them in src/main/java folder.