JATO Tutorial
|
Before developing any pages, we need to create the JATO application infrastructure. This is a one-time requirement for each JATO application.
JatoTutorial
to contain all
of our files. The structure under this directory will be a standard WAR file
directory structure./JatoTutorial
/JatoTutorial/jatotutorial/module1
/JatoTutorial/WEB-INF
classes
directory in the WEB-INF directory. You
will create, edit, and compile your Java source code files in the classes
directory./JatoTutorial/WEB-INF/classes
/JatoTutorial/WEB-INF/classes/jatotutorial /JatoTutorial/WEB-INF/classes/jatotutorial/module1
/JatoTutorial/WEB-INF/jato.tld
lib
directory in the WEB-INF directory./JatoTutorial/WEB-INF/lib
lib
directory./JatoTutorial/WEB-INF/lib/jato-1_2.jar
Your directory structure should now appear as follows:
/JatoTutorial |
Main working directory |
/jatotutorial |
Document directory for jatotutorial application |
/module1 |
Document directory for module1 module (jsp files here) |
/WEB-INF |
Web application information |
jato.tld |
JATO tag library descriptor file |
/classes |
Application classes |
/jatotutorial |
Directory for jatotutorial package classes |
/module1
|
Directory for module1 package classes |
/lib |
Additional application classes (jar files) |
jato-1_2.jar |
JATO jar file |
__appName__ServletBase.java
from the
/templates/1_2/ApplicationTemplates
directory to your /WEB-INF/classes/jatotutorial
directory. Be careful not to confuse your document directories with your
Java package directories, as they have the same names.
/JatoTutorial/WEB-INF/classes/jatotutorial/__appName__ServletBase.java
JatoTutorialServletBase.java
Token | Replacement Text |
---|---|
__appPackage__ |
jatotutorial |
__appName__ |
JatoTutorial |
Your code for JatoTutorialServletBase.java
should now look like
the following (note, this sample shows only the code affected by token replacement):
package jatotutorial; import com.iplanet.jato.*; import com.iplanet.jato.view.*; import com.iplanet.jato.util.*; public class JatoTutorialServletBase extends ApplicationServletBase { public JatoTutorialServletBase() { super(); } ... } |
ModelTypeMapImpl.java
from the /templates/1_2/ApplicationTemplates
directory to your /WEB-INF/classes/jatotutorial
directory.
/JatoTutorial/WEB-INF/classes/jatotutorial/ModelTypeMapImpl.java
Token | Replacement Text |
---|---|
__appPackage__ |
jatotutorial |
Note, this task will not make use of any application-specific Model classes; therefore you do not need to add any additional code to this class until instructed to do so.
SQLConnectionManagerImpl.java
from the
/templates/1_2/ApplicationTemplates
directory to your /WEB-INF/classes/jatotutorial
directory:
/JatoTutorial/WEB-INF/classes/jatotutorial/SQLConnectionManagerImpl.java
Token | Replacement Text |
---|---|
__appPackage__ |
jatotutorial |
Note, this task will not make use of any application-specific JDBC connections; therefore you do not need to add any additional code to this class until instructed to do so.
__moduleName__Servlet.java
from the
/templates/1_2/ModuleTemplates
directory to your /WEB-INF/classes/jatotutorial/module1
directory/JatoTutorial/WEB-INF/classes/jatotutorial/module1/__moduleName__Servlet.java
Module1Servlet.java
Token | Replacement Text |
---|---|
__appPackage__ |
jatotutorial |
__appName__ |
JatoTutorial |
__modulePackage__ |
module1 |
__moduleName__ |
Module1 |
Your code for Module1Servlet.java
should now look like this (note,
this sample shows only the code affected by token replacement):
package jatotutorial.module1; import javax.servlet.*; import javax.servlet.http.*; import jatotutorial.*; import com.iplanet.jato.*; import com.iplanet.jato.util.*; import com.iplanet.jato.view.*; public class Module1Servlet extends JatoTutorialServletBase { public Module1Servlet() { super(); } ... public static final String DEFAULT_MODULE_URL="../module1"; public static String PACKAGE_NAME=getPackageName( Module1Servlet.class.getName()); } |
web.xml
from the /templates/1_2/ApplicationTemplates
directory to your /WEB-INF
directory./WEB-INF/web.xml
Token | Replacement Text |
---|---|
__appPackage__ |
jatotutorial |
__modulePackage__ |
module1 |
__moduleName__ |
Module1 |
web.xml
file should look like this:
<?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE web-app PUBLIC '-//Sun Microsystems, Inc.//DTD Web Application 2.2//EN' 'http://java.sun.com/j2ee/dtds/web-app_2_2.dtd'> <web-app> <context-param> <param-name>jato:jatotutorial.module1.*:moduleURL</param-name> <param-value>../module1</param-value> </context-param> <servlet> <servlet-name>Module1Servlet</servlet-name> <servlet-class>jatotutorial.module1.Module1Servlet</servlet-class> </servlet> <servlet-mapping> <servlet-name>Module1Servlet</servlet-name> <url-pattern>/module1/*</url-pattern> </servlet-mapping> <taglib> <taglib-uri>/WEB-INF/jato.tld</taglib-uri> <taglib-location>/WEB-INF/jato.tld</taglib-location> </taglib> </web-app> |
|