Download Here

Transcript
Configuration and Deployment Examples
web.xml Example
The myapp/web/WEB-INF/web.xml file contains the class definitions for EJBs,
servlets, and JSPs that are executed within the Web site. The myapp Web module
specifies the following in its descriptor:
■
The default page to be displayed for the application’s root context as specified
using the admin.jar bind command (http://oc4j_host:port/myapp)
■
Where to find the stubs for the EJB home and remote interfaces
■
The JNDI name for the EJB
■
The included servlets and where to find each servlet class
■
How servlets are mapped to a subcontext using the <servlet-mapping>
element (/template) off of the application root context
The Web server looks for the following:
■
■
■
All servlet classes under WEB-INF/classes/<package>.<class>.
All HTML and JSP from the root of the WAR file that is pointed to by
<web-app name="<warfile.war>"> in the web-site.xml file, which is
packaged in the deployed corresponding application EAR file.
OC4J compiles each JSP from .java into .class the first time it is used and caches
it for subsequent use.
<web-app>
<display-name>myapp web application</display-name>
<description>
Web module that contains an HTML welcome page, and 4 JSP’s.
</description>
<welcome-file-list>
<welcome-file>index.html</welcome-file>
</welcome-file-list>
<ejb-ref>
<ejb-ref-name>TemplateBean</ejb-ref-name>
<ejb-ref-type>Entity</ejb-ref-type>
<home>TemplateHome</home>
<remote>Template</remote>
</ejb-ref>
<servlet>
<servlet-name>template</servlet-name>
<servlet-class>TemplateServlet</servlet-class>
<init-param>
<param-name>length</param-name>
<param-value>1</param-value>
</init-param>
</servlet>
</web-app>
ejb-jar.xml Example
The ejb-jar.xml file contains the definitions for a container-managed persistent
EJB. The myapp EJB deployment descriptor contains the following:
■
■
The entity bean uses container-managed persistence.
The primary key is stored in a table. This descriptor defines the type and fields of
the primary key.
B-38 Oracle Application Server Containers for J2EE Standalone User’s Guide