Справочник Пользователя для BEA 7

Скачать
Страница из 146
Converting and Porting Your Existing Applications into Web Applications
BEA WebLogic Server 7.0 Upgrade Guide
2-15
Porting a Simple Servlet from WebLogic Server 5.1 to 
WebLogic Server 7.0
The following procedure ports the simple Hello World Servlet that was provided with 
WebLogic 5.1 Server to WebLogic Server 7.0.
1. In WebLogic Server 7.0, create the correct directory structure, as described in 
 in Programming WebLogic Server HTTP 
Servlets. This involves creating a root application directory, such as 
C:\hello
, as 
well as a 
C:\hello\WEB-INF
 directory and a 
C:\hello\WEB-INF\classes
 
directory. Place the 
HelloWorld.Servlet.java
 file inside the 
C:\hello\WEB-INF\classes
 directory. 
2. Create a 
web.xml
 file for this servlet. If you have converted your 
weblogic.properties
 file, a 
web.xml
 file has already been created for you. If 
you registered HelloWorldServlet in your 
weblogic.properties
 file before 
you converted it, the servlet will be properly configured in your new 
web.xml
 
file. An XML file can be created with any text editor. The following is an 
example of a basic 
web.xml
 file that could be used with the HelloWorldServlet.
<!DOCTYPE web-app (View Source for full doctype...)> 
- <web-app> 
- <servlet> 
<servlet-name>HelloWorldServlet</servlet-name> 
<servlet-class>examples.servlets.HelloWorldServlet</servlet-cla
ss> 
</servlet> 
- <servlet-mapping> 
<servlet-name>HelloWorldServlet</servlet-name> 
<url-pattern>/hello/*</url-pattern> 
</servlet-mapping> 
</web-app>
For more information on 
web.xml
 files, see 
 in Assembling and Configuring Web Applications. A 
weblogic.xml
 file is not necessary with such a simple, stand-alone servlet as 
HelloWorld. 
For more information on 
weblogic.xml
 files, see 
 in Assembling and Configuring Web 
Applications