Previous Next vertical dots separating previous/next from contents/index/pdf

9. Running and Debugging the Application

In this section you will learn to setup a server and run your web application in a web container. You will also learn how to debug your web application using breakpoints in your web pages.

Background

Workshop offers a powerful JSP debugger that integrates with your existing Eclipse Java debugger. For example you can set a breakpoint in a JSP page, step into the Java implementation of a JSP tag, and then back to the page, and so forth. The IDE can automatically configure, deploy the web application, and start the server for you, or you can attach to an existing server for debugging.

Undeploy Previous Tutorial Code

WebLogic Server does not support the deployment of projects with the same name from two different locations on disk.

For this reason, anytime you deploy a sample or run through a tutorial, you should check your server for previous deployments of the same code. If your server already has a deployment of the sample or tutorial code, you should undeploy any previous code.

Creating a server configuration

Workshop has the ability to run and debug applications on most of the popular web containers that are in use today. Before you can run this sample application, you must have a server installed.

  1. Click on the Servers tab (at the bottom region of the IDE).
  2. Right-click on the Servers view and choose New > Server.

  3. Choose BEA WebLogic Server v10.0. Click Next.
  4. From the Domain home dropdown select BEA_HOME\wlserver_10.0\samples\domains\workshop_10.1. Click Next.
  5. Select the Struts tour project in the left pane and click Add to move it to the right pane. Click Finish.

    The new server is displayed in the Servers view.

Run/Debug the Application

Using breakpoints with web pages

  1. Double-click searchResults.jsp in the AppXplorer to open this page in the editor.
  2. In the Source editor, find the line containing the sonic:searchResults tag.
  3. <sonic:searchResults id="results" searchId="search"/>

  4. Right-click in the Source editor markers bar at this line location, and choose the Toggle Breakpoint command.
  5. The markers bar is the gray area at the left side of the Source editor.

  6. In the running web application, click the Rock link under the ‘your favorite music...’ image.
  7. The JSP debugger stops at the breakpoint set above.

  8. Notice that the JSP debugger added a JSP Variables view to the Debug perspective. On the JSP Variables view, expand the Available Variables node.
  9. This node shows the variables accessible by this page regardless of their origin (JSP page, Struts action, and so forth). This saves you time looking for the variables you are using in the page in the application server-specific maps!

  10. Select Run > Step Into, and the Java debugger stops in the doStartTag method of the JSP tag.
  11. Select Run > Step Return, and the control returns to the searchResults.jsp page.
  12. You can now continue stepping or select Run > Resume to resume the web application.
  13. Stop the server by clicking the Stop Server icon on the Console view title bar.

 

Related tasks

Special Considerations When Debugging JSPs

Click one of the following arrows to navigate through the tutorial:


Still need help? Post a question on the Workshop newsgroup.

 

Skip navigation bar   Back to Top