• Print  |
  • Feedback  |

FOCUS AREAS

Developer Resources

Products

Technologies

API Reference

SAS AppDev Studio 3.0 Developer's Site

Understanding the Directory Structure for webAF Web Applications

The Java Servlet Specification Version 2.3 requires that a Web application exist in a well-defined hierarchy of directories. This is a great benefit to application developers, since the same directory structure will be used when deploying to different platforms and using different Web server vendors.

The root of the directory hierarchy for a Web application is called the webapp base directory, and serves as the document root for files that are part of the Web application. The Web container maps a request for a unique context path to this base directory.

Default Development Directory Structure

For your convenience, webAF is set up so that selecting Tools [arrow] Start Java Web Server will start the current Web server to serve only the current webAF project. Assuming you used the New Project Wizard to build the initial content for a new Web application project MyWebApp in the default location, the basic directory structure will look like this:

    ...
        webAF
            projects
                MyWebApp
                    webapp
                        WEB-INF
                            classes
                            lib

where the ellipses represent the AppDev Studio installation path. You will have additional directories, but these are the heart of your webAF Web application project.

Primary directories for each Web application project

The most important directories are:

Directory pathDescription
...\webAF\projects\MyWebAppThe project directory. Contains:
  • webAF project file, MyWebApp.afx
  • the Ant build file, MyWebApp_build.xml
  • the Web application properties file, webapp.properties
These files are used by webAF to manage your project. These files will not be included in a WAR file when you are ready to deploy your Web application.
...\webAF\projects\MyWebApp\webappThe webapp base directory. Typically contains the index.jsp or index.html page that serves as the "entry point" to your Web application, as well as other resources. All files in or under this directory are accessible by name from the client, except those in or under subdirectory WEB-INF.
...\webAF\projects\MyWebApp\webapp\WEB-INFThe WEB-INF directory. Contains the deployment descriptor, web.xml. All files in or under this directory are not accessible by name from the client, and are manipulated by the Web container.
...\webAF\projects\MyWebApp\webapp\WEB-INF\classesThe classes directory. Contains sub-directories corresponding to the package names for all servlets and other java classes. For example, com.mycompany.mypkg.MyClass will be located in ...\webAF\projects\MyWebApp\webapp\WEB-INF\classes\com\mycompany\mypkg. By default, when generating a WAR file, .class files will be deployed with the Web application but .java files will not.
...\webAF\projects\MyWebApp\webapp\WEB-INF\libThe lib directory. Contains the supporting JAR files needed by the Web application. This will automatically be populated with the necessary JAR files for the web application template and options selected in the new project wizard.

By default, the context name for the Web application is the same as the project name, and is mapped to the webapp base directory. To access the initial page at ...\webAF\projects\MyWebApp\webapp\index.jsp, which is being served by the webAF internal server, the browser would request this URL: http://localhost:8082/MyWebApp/index.jsp. If you chose a servlet as your initial content type in the new project wizard, then the web.xml file will contain an entry generated by webAF that maps the Web application context name to that servlet.

You can change the context name at any time by selecting File Project Properties, choosing Options, and entering the new value for Context Name. Naturally this will not alter the directory structure of your Web application, but it will cause the web server to associate the new context name with the same base directory (when the Web server is re-started). For example, changing the context name to Magic would mean the client request should be http://localhost:8082/Magic/index.jsp.

Other directories for a Web application project

Additional directories are used by webAF to manage your project. These directories may not all be present, since some are generated only when needed:

Directory pathDescription
...\webAF\projects\MyWebApp\.ads_backup The backup directory. Contains renamed copies of certain files, created by webAF as files are modified.
...\webAF\projects\MyWebApp\content_templates The project content templates directory. Contains user-defined "boilerplate" for new files specific to this project.
...\webAF\projects\MyWebApp\mtls The MTL directory. MTL files are XML files that contain SAS enhancements to TLD files (tag library descriptors) for SAS tag libraries.
...\webAF\projects\MyWebApp\Palettes The palette directory. Contains XML files and associated resources that define the drag-and-drop palettes available in the webAF toolbar.
...\webAF\projects\MyWebApp\websvr_work The default work directory for the web server. Tomcat places translated .java and .class files for JSP files in a subdirectory corresponding to the context name.
...\webAF\projects\MyWebApp\webapp\images The images directory. Contains the graphical resources (GIF files) for SAS components.
...\webAF\projects\MyWebApp\webapp\scripts The scripts directory. Contains Javascript files for SAS components.
...\webAF\projects\MyWebApp\webapp\styles The styles directory. Contains the cascading style sheets for SAS components.
...\webAF\projects\MyWebApp\webapp\templates The templates directory. Contains "boilerplate" HTML files for SAS components.

External Web applications

The webapp base directory does not have to reside under the project directory. The new project wizard will enable you to create a new Web application external to the project directory, or to "adopt" an existing Web application as a project.