blob: 34094bb36f60c54fff711e5ebc888d74b0b371f6 [file] [log] [blame]
<?xml version="1.0" encoding="UTF-8"?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html lang="en-us" xml:lang="en-us">
<head>
<meta content="text/html; charset=utf-8" http-equiv="Content-Type" />
<meta name="copyright" content="Copyright (c) 2000, 2006 IBM Corporation and others. All rights reserved. This program and the accompanying materials are made available under the terms of the Eclipse Public License v1.0 which accompanies this distribution, and is available at http://www.eclipse.org/legal/epl-v10.html. Contributors: IBM Corporation - initial API and implementation" />
<meta name="DC.rights.owner" content="(C) Copyright 2000, 2006" />
<meta content="public" name="security" />
<meta content="index,follow" name="Robots" />
<meta http-equiv="PICS-Label" content='(PICS-1.1 "http://www.icra.org/ratingsv02.html" l gen true r (cz 1 lz 1 nz 1 oz 1 vz 1) "http://www.rsac.org/ratingsv01.html" l gen true r (n 0 s 0 v 0 l 0) "http://www.classify.org/safesurf/" l gen true r (SS~~000 1))' />
<meta content="task" name="DC.Type" />
<meta name="DC.Title" content="Debugging a servlet on a server" />
<meta name="abstract" content="The debugger enables you to detect and diagnose errors in your application. It allows you to control the execution of your program by setting breakpoints, suspending threads, stepping through the code, and examining the contents of the variables. You can debug a servlet on a server without losing the state of your application." />
<meta name="description" content="The debugger enables you to detect and diagnose errors in your application. It allows you to control the execution of your program by setting breakpoints, suspending threads, stepping through the code, and examining the contents of the variables. You can debug a servlet on a server without losing the state of your application." />
<meta content="servlets, debugging on a server, servers, debugging servlets, breakpoints, adding to servlets, threads, suspending in a servlet" name="DC.subject" />
<meta content="servlets, debugging on a server, servers, debugging servlets, breakpoints, adding to servlets, threads, suspending in a servlet" name="keywords" />
<meta content="XHTML" name="DC.Format" />
<meta content="tservlet_wst" name="DC.Identifier" />
<meta content="en-us" name="DC.Language" />
<link href="../../org.eclipse.wst.doc.user/common.css" type="text/css" rel="stylesheet" />
<title>Debugging a servlet on a server</title>
</head>
<body id="tservlet_wst"><a name="tservlet_wst"><!-- --></a>
<h1 class="topictitle1">Debugging a servlet on a server</h1>
<div><p>The debugger enables you to detect and
diagnose errors in your application. It allows you to control the execution
of your program by setting breakpoints, suspending threads, stepping through
the code, and examining the contents of the variables. You can debug a servlet
on a server without losing the state of your application.</p>
<div class="section" id="tservlet_wst__tservlet_context"><a name="tservlet_wst__tservlet_context"><!-- --></a>To debug a servlet on a server:</div>
<ol>
<li class="stepexpand" id="tservlet_wst__tservlet_step1"><a name="tservlet_wst__tservlet_step1"><!-- --></a><span>In the Project Explorer view, open your servlet.</span>
In a Web project, servlets are located in the JavaSource folder. The
servlet opens in an editor.</li>
<li class="stepexpand" id="tservlet_wst__tservlet_step2"><a name="tservlet_wst__tservlet_step2"><!-- --></a><span>To set one or more breakpoints in the editor,
double-click in the margin beside the line of code that you want to set as
a breakpoint.</span></li>
<li class="stepexpand" id="tservlet_wst__tservlet_step3"><a name="tservlet_wst__tservlet_step3"><!-- --></a><span>Ensure the project is associated to run on
a server.</span></li>
<li class="stepexpand" id="tservlet_wst__tservlet_step4"><a name="tservlet_wst__tservlet_step4"><!-- --></a><span>Select the servlet and from the servlet's context
menu in the Project Explorer view, click <span class="uicontrol">Debug As &gt; Debug on Server</span>.</span>
Open the Servers view to see that the server is launched.</li>
<li class="stepexpand" id="tservlet_wst__tservlet_step5"><a name="tservlet_wst__tservlet_step5"><!-- --></a><span>When the breakpoint is hit, the Debug view
opens.</span> Step through the code, inspect and display variables, and
make any necessary changes to the servlet. For detailed information on debugging,
refer to the online help.</li>
<li class="stepexpand" id="tservlet_wst__tservlet_step6"><a name="tservlet_wst__tservlet_step6"><!-- --></a><span>When you are finished debugging, remove the
breakpoint and save the servlet.</span></li>
<li class="stepexpand" id="tservlet_wst__tservlet_step7"><a name="tservlet_wst__tservlet_step7"><!-- --></a><span>Click the <span class="uicontrol">Resume</span> icon
on the Debug toolbar to execute the servlet.</span></li>
<li class="stepexpand" id="tservlet_wst__tservlet_step8"><a name="tservlet_wst__tservlet_step8"><!-- --></a><span>If you have hot method replace enabled, your
changes are already in the running application.</span></li>
<li class="stepexpand" id="tservlet_wst__tservlet_step9"><a name="tservlet_wst__tservlet_step9"><!-- --></a><span>If you have automatic class reloading enabled,
which is the default setting, click the <span class="uicontrol">Refresh</span> icon
in the Web Browser to update the changes.</span> You do not lose the state
of your application.</li>
<li class="stepexpand"><span id="tservlet_wst__tservlet_cmd10"><a name="tservlet_wst__tservlet_cmd10"><!-- --></a>If you do not have automatic class reloading
enabled, you lose the state of the application.</span> To
update the changes, restart the server.</li>
</ol>
<div class="section" id="tservlet_wst__tservlet_result"><a name="tservlet_wst__tservlet_result"><!-- --></a><strong>Result:</strong><p>The server recognizes your changes.</p>
</div>
</div>
</body>
</html>