|
||||||
Table of Contents |
||||||
1. IntroductionWelcome to the AJAX Debugging tutorial for MyEclipse. In this tutorial we are going to show you how the AJAX debugging functionality in MyEclipse works by walking you through a remote debugging example. Hopefully, this will give you enough of an introduction so you can start debugging your own AJAX code or continue learning by debugging someone else's. |
||||||
2. Suggested AudienceThis tutorial is intended for developers who are somewhat familiar with MyEclipse or Eclipse so you recognize navigation within the IDE, and understand some of the more common views like the debugger. It is also helpful if you have done some JavaScript programming in the past, or have a basic understanding of it, so the method calls and arguments make sense when you see them and inspect their values.
If you are just getting started in programming in general, you
are certainly welcome to quickly get an overview of what
MyEclipse is capable of when performing with AJAX development,
but some of the mechanisms mentioned below, like breakpoints,
debuggers and variable inspection, may seem a bit foreign at
first.
To help get introduced to JavaScript and AJAX please have a look at our introductory links in our Resources section. To get a better feel for MyEclipse and learning more about it, please check out our product Documentation for more material. |
||||||
3. System Requirements
This tutorial was created with MyEclipse 5.1. If you are using a
another version of MyEclipse, most of these screens and
instructions should still be very similar.
If you are using a newer version of MyEclipse and notice portions
of this tutorial looking different than the screens you are
seeing, please
let us know and we will make sure to
resolve any inconsistencies.
|
||||||
4. AJAX DebuggingIn this tutorial we are going to connect to the community-moderated developer site dzone.com. For those of you that are not familiar with Dzone (or Digg.com), the way the site works is that users submit stories and everyone else votes on the stories either adding 1 or subtracting 1 from the vote total. At any time, the number of votes a story has is used to determine how "important" that story is and determines whether or not the story is shown on the front page of the site. The interesting part about this site for this tutorial is that the developers of Dzone use AJAX calls and the DWR AJAX framework to handle the voting. In this tutorial we are going to debug the method call that increases a story's vote count to see how that particular AJAX call works. For the purpose of this introductory tutorial, we will not get into all the complexities of JavaScript debugging. Rather, we intend to show a simple example with enough information to enable you to start debugging your own projects. If you have any questions about the tools while you are working, please post them to our AJAX support forums. Step 1
The easiest way to start debugging AJAX calls is to simply
connect the MyEclipse AJAX Web Browser to the site you want to
debug. We will start our debugging session by opening the
AJAX Web Browser. This is done by selecting the
AJAX Web Browser button in the MyEclipse toolbar and clicking it as
shown below (NOTE: Click "Play" to see a demonstration):
After clicking the AJAX Web Browser toolbar button, the browser
window will open. You may be confused about all the views in this
window but the important thing to note is that until you start
debugging the only two views that are going to be important are
the
MyEclipse AJAX Web Browser view and the
DOM Inspector view.
The browser view is fairly straight forward; it's simply an instrumented web browser built for debugging. The DOM Inspector view is an outline of the DOM (Document Object Model) of the web page you are currently viewing. It shows you, the layout of the page, based on the tag structure. If you haven't done AJAX development before then this may not seem that helpful. However, as you start to write JavaScript to hide or show portions of a page in response to a user's interaction with it, you can start to see why being aware of the page's DOM will be important.
Step 2
|
|
Figure 2. Navigate to the Dzone
website and then start the debugging session
|
After the debugging session has started, what we want to do now
is get used to the interface a little bit and see a quick
description of what all the different views do (now that they are
all loaded up with information).
NOTE:
To vote on a news story on dzone.com, you must have a
Dzone account. You can register for your free Dzone account here.
The next step is to trigger a vote action and use the AJAX Request Monitor to watch the request occur in real-time to understand what JavaScript function is getting called.
Once we've determined which function is being called, we'll set a
breakpoint in that JavaScript function and then vote again.
This will cause the breakpoint to be hit and give us a chance to
take a look at exactly what the script is doing (NOTE: Click
"Play" to see a demonstration):
|
Figure 3. After starting the
debugging session, setting and hitting a breakpoint is easy
|
We hope you now have a good idea of how AJAX debugging works in MyEclipse. We've worked hard to make the debugging fast and easy for not only your own work, for which you have the source code, but for debugging other applications to learn how some of the more advanced AJAX work is done. An additional benefit of debugging is that you can shorten ramp-up time on a new project if you can analyze the application from a user's perspective, as opposed to simply digging through source code and trying to learn it from the bottom up. If you have any suggestions for us to help make it more informative, please let us know.
Below we would like to provide you with some more information
pertaining to the topic covered in this tutorial. We offer the
FAQ section for quick
references to common questions and the
Resources
section with links to other helpful resources online that you
may want to become familiar. We realize we can't cover
every question you may have in one tutorial, but between this
tutorial contents and our additional learning resources we hope
you are far on your way to feeling comfortable with the
technology.
This section will list some of the more common questions that can come up while performing the tasks outlined in this tutorial.
In this section we want to provide you with additional links to resources that will make learning about AJAX and AJAX debugging easier. While this is not an exhaustive list, we do make an effort to point to the more popular links that should provide you with diverse, high-quality information.
For developers that don't quite understand the "JavaScript" part of "AJAX", we strongly suggest you have a look at our Introduction to JavaScript section of links below. Those articles will introduce you to basic JavaScript programming so you'll understand how JavaScript works to enable you to more easily understand where "debugging" stands in that process.
For the people that want to learn more about AJAX in general and
get some examples right away, skip down to the
AJAX Resources, Sites and Tutorials section for some
great links.
We would like to hear from you! If you liked this tutorial, has some suggestions or even some corrections for us please let us know. We track all user feedback about our learning material in our Documentation Forum. Please be sure to let us know which piece of MyEclipse material you are commenting on so we can quickly pinpoint any issues that arise.