Struts Folder Structure in Tomcat (Apache)

Source From :-

Struts is one of the MVC Based Web frameworks in Java EE. It is used in creating simple web applications that are more flexible and easy to debug. Many of the blogs till have written about the folder structure of Struts and now i am going to discuss about the neat folder structure of struts in the Apache Tomcat version 7/6/5 or below.

The structure is mostly similar to that of the structure of the servlets/jsp. A little change can be noted here.

webapps
     |-index.html
     |-custom.html
     |-myjsp.jsp
     |-hello.jsp
     |-WEB-INF
            |-classes
                 |-MyAction.java
                 |-MyAction.class
                 |-MyBean.java
                 |-MyBean.class
                 |-MyRequestProcessor.java
                 |-MyRequestProcessor.class
            |-lib
                |-struts-core-1.3.10.jar
                |-struts-taglib-1.3.10.jar
                |-commons-beanutils-1.8.0.jar
                |-commons-chain-1.2.jar
                |-commons-digester-1.8.jar
                |-commons-logging-1.0.4.jar
                |-commons-validator-1.3.1.jar
            |-web.xml
            |-struts-config.xml

Note: Additional jar files in the lib directory may be needed example, struts-tiles-1.3.10.jar is necessary when you do use the tiles framework.

The classes directory: The classes directory should contain the relevant classes i.e. the Action class, Form Bean class (optional), MyRequestProcessor (Your own RequestProcessor class [Optional]), the Model class (optional). Optional means that these classes are not needed at all situations i.e. all applications. Usually a bean class and Model class is used when you interact with database. Helloworld example does not make use of these classes.

HTML Files: The HTML files and jsps are also seen in the servlets/jsp. So that is it.

web.xml: The web.xml file does the same thing as in the servlets. But with a little bit of change, later discussed on other posts.

struts-config.xml: This is the file that maps the action class for some user’s request. It is specified in the web.xml file. Note: As is specified in the web.xml, you can rename struts-config.xml to myconfig.myext and can also change where it is located. Whatever you do, you must specify the complete path along with the name and extension of this file in the web.xml.

webapps: Webapps folder is the webapps folder in the Tomcat. It comes by default when you install your tomcat. 

– See more at: http://java-demos.blogspot.in/2012/09/struts-folder-structure-for-apache.html#sthash.xobJngMW.dpuf