Hi,

Jay SenSharma

Jay SenSharma

As a WebLogic Administrator Many times we want to make some changes in the application provided by the Development team. But it is not good for a WebLogic Administrator to make changes in the application archieve provided by the Application Development team. But to fulfill some environmental requirements the Administartor has to make some changes in the application.

WebLogic provides a best way for the WebLogic Administrators to alter the different Tags present inside the Application deployment descriptors like adding a new Tag or replacing a value of a Tag mentioned in the “web.xml” or in “weblogic.xml” or in any of the deployment descriptor like “weblogic-ejb-jar.xml”,”application.xml”, “weblogic-application.xml”…etc.

Here we are going to see a very simple demonstration on adding a WelCome Page to our Application.

Why We need Welcome Page?

Suppose Users  access my application’s welcome page like following : “http://someHost:7001/MTestApp/login.htm”

But i don’t want to display the “login.htm”  in the URL rather i want as soon as the user enters the following URL:   “http://someHost:7001/MTestApp” the “login.htm” Page content should automatically appear in the webPage.

For example if we have the following kind of “web.xml” file inside our application :

<?xml version="1.0? encoding="UTF-8"?>
<web-app id="WebApp_9" version="2.4" xmlns="http://java.sun.com/xml/ns/j2ee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">

<!--   We don't have any welcome page defined here -->

</web-app>

And if we want to add the <welcome-file-list> Tag set in the above “web.xml” file without physically editing the WAR file or the “web.xml” file as below, then we can do it using “plan.xml” file

<?xml version="1.0? encoding="UTF-8"?>
<web-app id="WebApp_9" version="2.4" xmlns="http://java.sun.com/xml/ns/j2ee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">

<welcome-file-list>
<welcome-file>login.htm</welcome-file>
</welcome-file-list>

</web-app>

Step1). We assume that already your application is deployed on the WebLogic Server.

Step2). Suppose your WAR name is “TestWelcomePage” (i am considering it as an exploded WAR…you can use it with Archieved WAR file as well).

Step3). Anywhere in your file system Just paste the following “plan.xml” file: (Suppose Location is “F:WelcomePage_PlanDemo” )

<?xml version='1.0' encoding='UTF-8'?>
<deployment-plan xmlns="http://www.bea.com/ns/weblogic/90" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.bea.com/ns/weblogic/90 http://www.bea.com/ns/weblogic/90/weblogic-deployment-plan.xsd" global-variables="false">

<application-name>TestWelcomePage</application-name> <!-- You need to change this Line and Put your Web Application Name -->

<variable-definition>
<variable>
<name>welcomeFileName</name>
<value>login.htm</value>
</variable>
</variable-definition>

<module-override>
     <module-name>TestWelcomePage</module-name> <!-- You need to change this Line and Put your Web Application Name -->
     <module-type>war</module-type>
     <module-descriptor external="true">
          <root-element>web-app</root-element>
          <uri>WEB-INF/web.xml</uri>
          <variable-assignment>
                    <name>welcomeFileName</name>
                    <xpath>/web-app/welcome-file-list/welcome-file</xpath>
          </variable-assignment>
     </module-descriptor>
</module-override>
<config-root>F:WelcomePage_PlanDemo</config-root> <!-- You need to change this Line and Put the location of plan.xml file wherever u have pasted it -->
</deployment-plan>

Step4). Login to AdminConsole and goto deployments page—-> the select your Application (After Pressing Lock & Edit Button) –> update (click this button)—> browse your “plan.xml” file location and then finish.

Once the changes will be activated ….Next time your will see that your Welcome page is changed.

Note: you won’t see any changes in the Actual WAR file (inside the application), this entry in plan.xml will be used by weblogic apart from the Actual application archieve. This is the biggest advantage of using plan.xml feature of weblogic.
.

.

Thanks

Jay SenSharma

If you enjoyed this post, please considerleaving a comment or subscribing to the RSS feed to have future articles delivered to your feed reader.