Recipe 2.5 Deploying an Individual JSP on WebLogic


You want to quickly test a JSP without deploying it as part of a new web application.


Copy and paste the JSP into the top-level directory of BEA WebLogic Server 7.0's default web application, then request the JSP in a browser.


A JSP file can be "hot deployed" on WebLogic 7.0's default web application without having to redeploy the entire web application. This default web application is located at <WebLogic-installation-directory>/user_projects/< name -of-your-domain>/applications/DefaultWebApp . If you paste your JSP file into this directory ( DefaultWebApp ), it will be available to receive requests without redeploying the default web application. If your JSP file is named newfile.jsp , then the URL for requests to this page would be http://localhost:7001/newfile.jsp . Note the absence of a context path or application name in the URL. If the request is for the default web application, then the JSP files appear following the forward slash ( / ) after the host:port part of the URL (in other words, after the localhost:7001/ part).

To repeat a prior caveat: placing a JSP file in a deployed web application in order to test it will not work if the JSP depends on application-specific resources such as servlets, custom tags, or other Java classes, because there is no guarantee that the temporary host web application you are using for the JSP has access to those resources.

In most cases, the JSP is already part of a web application, and several tools exist to redeploy a web application, including Ant, BEA WebLogic Builder, and the WebLogic Administration Console.

Finally, you can also copy and paste a JSP file into another WebLogic web application. However, that application must be deployed in exploded directory format, meaning that the application has not been deployed in archive form (as a WAR or EAR file). Therefore, place the JSP file in the application's top-level directory. If the application is named "newapp," this directory is named <WebLogic-installation-directory>/user_projects/<name-of-your-domain>/applications/newapp .

See Also

Recipe 2.3; Recipe 2.7-Recipe 2.10; WebLogic's Server 7.0 programmer documentation:

Java Servlet & JSP Cookbook
Java Servlet & JSP Cookbook
ISBN: 0596005725
EAN: 2147483647
Year: 2004
Pages: 326

Similar book on Amazon © 2008-2017.
If you may any questions please contact us: