0

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.

user777777
  • 228
  • 4
  • 25

1 Answers1

0

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.

Bala
  • 1,295
  • 1
  • 12
  • 23
  • Thanks for the answer..Just a doubt..if I am following MVC structure then I can have the extjs controller,model and store in the Webcontent>com folder right? – user777777 Aug 25 '14 at 05:35
  • 1
    Structure looks fine but it is advised to have folder name as 'app' instead of com (Check out here: http://docs.sencha.com/extjs/4.2.1/#!/guide/application_architecture) – Bala Aug 25 '14 at 11:46
  • Is it the right way to have the extjs library(resources and src folders from the extjs library) in the WebContent folder of the project. Because for an enterprise level project, if we are including it here, it actually takes a lot of time to build and run the project. Am I doing something wrong here?or Any suggestions regarding this would help..Thanks – user777777 Sep 23 '14 at 07:31
  • You have to make it accessible to the client, hence you should keep it in Web content folder. use minification and compression to reduce the size. any way these libraries will be cached into user's browser unless user configures 'no cache' – Bala Sep 23 '14 at 07:36
  • Should the Compression be done by the developer explicitly? If so,are there different ways that can be followed for performing the compression? – user777777 Sep 23 '14 at 08:06
  • Yes, it should be done by developer explicitly. It can be done at deployment time (ycompressor) or run time(Google Web utilities). – Bala Sep 23 '14 at 08:15