The PageCompileServlet sits in the DAS servlet pipeline, typically immediately after the DropletEventServlet. It is the responsibility of PageCompileServlet to produce an HTML or other browser-friendly page from the JHTML source file representing the requested page. The PageCompileServlet ensures that the following tasks are performed for each requested page:

The PageCompileServlet handles two tasks in conjunction with the Page Processor. The first task is to determine whether the JHTML page needs to be compiled into a Java source file and then to a servlet. The combination of the two processes is known as compilation. If your pages are not precompiled by a page compiler, this process is necessary the first time a page is requested. Future changes to source files require pages to undergo compilation again. The PageCompileServlet detects a change in a page using one of the following three methods:

When discrepancies are encountered in a comparison, PageCompileServlet generates a new servlet. Keep in mind that the default way a comparison is conducted depends on the last modified date, so be sure to preserve the initial last modified date for a source file by not performing operations, such as a copy on UNIX, that changes it.

One property of the PageCompileServlet that you should be familiar with is includePagesByMimeType. This property controls whether static and dynamic pages are compiled. By setting this property to true, the ATG platform uses a page’s MIME type to determine if the page needs to be compiled. This way, static pages, such as those with a .html or .txt extension, are not unnecessarily processed by the page compiler. When this property is set to false, all pages are compiled by the page compiler, regardless of whether they contain static or dynamic information. This property is set to false by default.

Page Processor and Extended JHTML Page Processor

The PageCompileServlet attaches to a Nucleus service called the Page Processor. When the Page Processor encounters a request, it finds the requested page’s extension and compares it to the extensions defined in its jspExtensions property. Requests for pages with a .jhtml extension are passed to the Extended JHTML Page Processor, which is a child service of the Page Processor.

The Extended JHTML Page Processor is a service implements properties that control the page compilation process. You can customize the behavior of the PageCompileServlet by changing these properties of the ExtendedJhtmlPageProcessor component at /atg/dynamo/servlet/pagecompile/ in your Nucleus configuration. However, these properties are given default values that should apply to the majority of ATG customers so be sure to make changes to values only when you are absolutely certain you need to.

Keep in mind that the Extended Page Processor compiles JHTML pages that use JHTML and JSP 1.1 syntax. Use the following additional properties on the Extended JHTML Page Processor to view the current settings used for JHTML compilation and, when necessary, to adjust the default configuration:

Specifies whether the path to the requested page is translated into the actual file path at runtime (true). When set to false, this property indicates that path translation should occur during page compilation and incorporated into the resultant servlet. By default, this property is set to the same value as /atg/dynamo/servlet/pipeline/FileFinderServlet.alwaysTranslate.

Set this property set to false in order to optimize performance unless the machine where you compile pages is not the same machine from which they are executed. In this case, alwaysTranslatePath should be set to true so the path is resolved at runtime to provide the correct file location.

This property is set by reference to the /atg/dynamo/Configuration component. It specifies the name of the command to use for compiling the Java files generated by the PageCompileServlet. The default value assumes that you use Javac.

Specifies the class to use to compile .java files for the PageCompileServlet. By default, this property is set to null, indicating that the compiler set in the compileCommand property (usually javac) is used for page compilation. You can overwrite the default setting by supplying a value to this property.

The two compilers available to you are javac and ATG strongly encourages using javac in the production environment, but you might choose to use in a development environment for the following reasons:

To use, set the javaCompilerClassName property to atg.servlet.pagecompile.SunJavaSourceCompiler and add tools.jar to your CLASSPATH.

Specifies a package name prefix to prepend onto the name of the generated classes. The default value is null.

Matches a path for a source JHTML page to a package prefix so that when a file is compiled into a servlet, the package name uses the package prefix you supply here rather than the file’s absolute path. This property is helpful when you want to compile JHTML pages into a servlet from one machine and execute them from another. During compilation, the Extended JHTML Page Processor checks the file path to see if it includes a package prefix defined in this property and, if so, resolves the package using the corresponding path prefix.

Providing a value to this property means that you do not want the package for the resultant servlet to be derived from the file’s current location. It is likely that you also want to set alwaysTranslatePath to true.

The pathPrefixMap property is similar to the packagePrefix property in that it provides a value that becomes part of the package name. The main difference between the two is that packagePrefix is supplied as the beginning of the package name to all pages you compile, while pathPrefixMap is given only to the servlets with source files located in the directory structures provided in pathPrefixMap. So, if you define both packagePrefix and pathPrefixMap, the following package names might result:


The first two packages assume that A and BBBB are pathPrefixMap keys. The last package name is compiled when the file path does not match any key in pathPrefixMap and the file is in the compilation root directory.

Designates a relative path to a directory holding precompiled JHTML pages in a JAR file. This property can hold either a JAR or directory. The contents in this property are relative to the value set by the {atg.dynamo.home} variable, which is usually <ATG9dir>\home. When the variable is not set, precompiledClassPath is relative to <ATG9dir>. The default value, pagebuild/precompiled.jar, is the location where the batch compiler deposits the precompiled pages. If you have a different set of precompiled pages for each module, you can include paths to each in this property as long as they are separated by the operating system-appropriate delineator.

The PageCompileServlet uses this property to find precompiled page and decide whether a new version of the page needs to be compiled into a servlet. Because this property accepts only one value, be sure to place your precompiled pages in a single JAR file.

Specifies the directory where compiled JHTML pages should be output to, from the point of view of the machine that compiles them. By default, this property is set to \pagebuild, which is appropriate if you compile and execute your pages on the same machine. The compiled pages are placed in a directory located by appending the context root to the path you supply here. Modify this property value if you want to compile and execute your pages on two different machines. The value you provide should direct the ATG platform from the machine that compiles the pages to the machine that executes them.

loading table of contents...