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

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

Using Workshop for JSP, you can run and debug your web application with any of the major application servers and servlet containers, such as Jakarta's Tomcat, JBoss, BEA's WebLogic, and IBM's WebSphere. Workshop for JSP 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.

Creating a server configuration

  1. 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. If the Servers view tab is not displayed, click Window > Open Perspective > Workshop to display it (or click Window > Show Views > Other then expand Server, click on Servers and click OK).
    2. Right click on the Servers tab and choose New > Server.

    3. Choose the type of server that you have installed. Click Next.

    4. Select the project name in the left pane and click Add to move it to the right pane. Click Finish.
    5. The new server is displayed in the Servers view.

Run/Debug the Application

To run the application, right click on the home.jsp file either in the editor or in Package Explorer or AppXplorer views. Choose Run As > Run on Server.

To debug your application, right click on the home.jsp file and choose Debug As > Debug on Server.

Using breakpoints with web pages

  1. Double-click searchResults.jsp in the Package Explorer 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 Add 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. Activate this view by clicking the JSP Variables tab, and expand the Available Variables node.
  9. This 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

Running and debugging your application

 

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

 

Skip navigation bar   Back to Top