Customizing Your Development Environment

Once you have your WebLogic server set up, you can start development. Organizing your files into a directory structure will ease the development process. The following sections deal with the directory structure for different J2EE components' development.

Directory Structure for Developing Servlets

The servlets that you create during the course of this book have to go into a directory called classes. The location of this classes directory, in case you wish to deploy it in an exploded format, is as follows:

 BEA_HOME\user_domains\mydomain\applications\ShoppingApp\WEB-INF\classes  

Here, ShoppingApp directory is the Web application directory.

If you wish to use a WAR file instead, this WAR file will go directly under the applications directory in the path just shown.

Note that the directory structure of the elements of the WAR file that you create should be as seen in Figure B.10:

Figure B.10. Directory structure of a WAR file.

graphics/bfig10.gif

For the example servlet applications, you first develop the code in directories exampleHiddenVar (servlet session maintenance with hidden variables), exampleURLRewriting (servlet session maintenance with URL rewriting), exampleCookie (servlet session maintenance with cookies), and exampleHttpSession (servlet session maintenance with HTTP session) all under the directory C:\book\code, which you compile into the directory C:\book\code\ShoppingApp\WEB-INF\classes.

To make the process of development easier, create the following compile and run batch files.

Note

The compile file for the application using the examplesHiddenVar directory is shown in this appendix. For the other individual directories, change the directory indicated by APP_DIR to the directory of the application being developed.

This compile file specifically is meant to be used when you are using a WAR file. In case you wish to deploy your application in an exploded format, remove the jar cv0f statement and all statements related to the WAR file. Then put in statements to save the whole ShoppingApp directory into the path %BEA_HOME%\user_domains\mydomain\applications.


The sample compile.bat file is as follows:

 @echo on  set BEA_HOME=C:\bea set APP_DIR=C:\book\code\exampleHiddenVar call %BEA_HOME%\user_domains\mydomain\setEnv set CLASSPATH=%CLASSPATH%;%BEA_HOME%\jdk131\lib\dt.jar;         %BEA_HOME%\jdk131\lib\tools.jar; set CLASSPATH=%CLASSPATH%;.\ShoppingApp\WEB-INF\classes;.; cd %APP_DIR% javac -d C:\book\code\ShoppingApp\WEB-INF\classes *.java if errorlevel 1 goto DISCONTINUE cd.. del *.war jar -cv0f ShoppingApp.war del  %BEA_HOME%\user_domains\mydomain\applications\ShoppingApp.war copy ShoppingApp.war %BEA_HOME%\user_domains\mydomain\applications :DISCONTINUE echo [ERROR] - cannot continue ENDLOCAL 

The sample run.bat file is as follows:

 set BEA_HOME=C:\bea  cd %BEA_HOME%\user_domains\mydomain call startWebLogic 

Note

Entering the user ID and password for your server in the startWebLogic.cmd file speeds up your development a little. However, this is not advisable in a production environment.


Directory Structure for Developing JSPs

The JSPs are to be saved in the directory C:\book\code\JSP, which you have to create directly under the Web application directory. This is the document root directory, and any JSPs or HTML files should be saved in this directory.

Directory Structure for Developing EJBs

In this book, the code for EJB applications is developed in the directories BMP, CMP, stateless, and stateful under the directory C:\book\code\EJB. The compiled EJB code is saved in the BEA_HOME\user_domains\mydomain\applications directory for hot deployment of the EJBs.

Table B.1 gives an overview of the locations of the various kinds of components in your application.

Table B.1. Locations for Deployment of Files

Type of File

Location in BEA_HOME for Deployment

Servlet classes, exploded format

%BEA_HOME%\user_domains\mydomain\applications\web application directory\WEB-INF\classes

WAR file of the servlet executable file

%BEA_HOME%\user_domains\mydomain\applications

JSP

%BEA_HOME%\user_domains\mydomain\applications\web application directory

Image files

%BEA_HOME%\user_domains\mydomain\applications\web application directory\Images

EJB JAR files for hot deployment

%BEA_HOME%\user_domains\mydomain\applications\web application directory



Sams Teach Yourself BEA WebLogic Server 7. 0 in 21 Days
Sams Teach Yourself BEA WebLogic Server 7.0 in 21 Days
ISBN: 0672324334
EAN: 2147483647
Year: 2002
Pages: 339

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net