Sun Microsystems Logo

 

 
 

Sun[tm] ONE Studio 4, Enterprise Edition for Java[tm] with Application Server 7 Tutorial
Modifying the Application
PREV PREV NEXT

 

In this section, you will leverage the dynamic redeployment feature of the application server by modifying several different components in the application, redeploying and retesting the application without restarting the application server. Each exercise is very basic in that you will modify the source code of various types of files, recompile when necessary and simply redeploy the application. The combination of the IDE's automatic reassembly features and the application server's dynamic redeployment capabilities should make your cycle times as short as possible.

  1. Modify HTML File
  2. Modify JavaServer Pages[tm] (JSP[tm]) File
  3. Modify Servlet
  4. Modify EJB[tm]

Modify HTML File

1. In Explorer, double click the index.html file located under the web module.

2. Change the following line from:

<title>JDBC-SIMPLE Sample Application</title>

to:

<title>MODIFIED JDBC-SIMPLE Sample Application</title>

Also modify the page title that is displayed as part of the HTML content. Change:

<b><font face="Arial"><font color="#000000"><font size=+2>JDBC-SIMPLE
Sample Application</font></font></font></b>

to:

<b><font face="Arial"><font color="#000000"><font size=+2>MODIFIED JDBC-SIMPLE
Sample Application</font></font></font></b>

3. Save your changes to the file.

4. Select the jdbcSimpleApp node in Explorer, right-click and select Deploy.

5. After deployment completes, access the application to see the change.

You should see the modified page title at the top of the browser window.

Modify JSP File

1. In Explorer, double click the GreeterDBView.jsp file located under the web module.

2. Change the following line from:

Good <%= messageString%>, <%= nameString%>. Enjoy your <%= messageString%>.

to:

Good <%= messageString%>, <%= nameString%>. Have a great <%= messageString%>.

3. Save your changes to the file.

4. Select the jdbcSimpleApp node in Explorer, right-click and select Deploy.

5. After deployment completes, access the application to see the change.

Enter your name and click Process.

You should see the modified greeting string.

6. Access the application once more to see how quickly the subsequent requests are processed.

Modify Servlet

1. In Explorer, navigate to the GreeterDBServlet file under the WEB-INF -> Classes area of the mounted web module.

2. Double click the GreeterDBServlet located under the web module.

3. In the doGet() method, change the following line from:

System.out.println("\nGreeterDBServlet is executing...");

to:

System.out.println("\nMODIFIED GreeterDBServlet is executing...");

4. Recompile the servlet by right clicking on the source editor and selecting Compile.

5. Select the jdbcSimpleApp node in Explorer, right-click and select Deploy.

6. After deployment completes, run the application and monitor the server log file. Look for the MODIFIED string to appear at the very beginning of the stdout messages generated by the application.

Modify EJB

1. In Explorer, navigate to the GreeterDBBean file under the mysimple/src filesystem.

2. Double click the GreeterDBBean object.

3. In the getGreeting() method, change the following line from:

System.out.println("GreeterDB EJB is determining message...");

to:

System.out.println("MODIFIED GreeterDB EJB is determining message...");

4. Recompile the implementation class by right clicking on the source editor and selecting Compile.

5. Select the jdbcSimpleApp node in Explorer, right-click and select Deploy.

6. After deployment completes, run the application and monitor the server log file. Look for the MODIFIED string to appear in the stdout messages generated by the application.

Now that you've experienced the quick modification cycle, proceed to Debugging the Application to gain a sense of stepping through various components of the application.

PREV PREV NEXT