Post new topic   Reply to topic
View previous topic Printable version Log in to check your private messages View next topic
Author Message
wmstoval
Post subject: How can I set breakpoints in html/javascript fragments?  PostPosted: Jul 30, 2008 - 11:50 AM



Joined: Apr 05, 2007
Posts: 30

I want to debug some javascript that comes from html that's assembled at runtime by the application. What the app does is treat the ".html" file as something of a template with placeholders for runtime-generated content. While this should be done with a technology like JSP, this application already exists and I need to work on it.

So if I view the html and set a breakpoint on a javascript line inside a script element, I apparently never hit my breakpoint because the URL the client references doesn't refer to the html file? Instead, my servlet programmatically accesses that file while delivering content to the client.

For example, let's say I have an html file called my_app.html. My servlet is programmed to respond to a url like http://localhost:8080/myapp/home by opening my_app.html, plugging in some runtime content like the user's name and streaming that to the client.

So apparently the javascript debugger has no way to relate the file with my breakpoint in it to the content the client browser received?

Do I need to externalize my JavaScript code into files that are separate from these html fragments? Or is there maybe a simpler strategy that doesn't impact this existing application that much?

Thanks for your help.
 
 View user's profile Send private message Visit poster's website  
Reply with quote Back to top
support-rkalla
Post subject: RE: How can I set breakpoints in html/javascript fragments?  PostPosted: Jul 30, 2008 - 05:53 PM
Moderator
Moderator


Joined: Jan 06, 2004
Posts: 23305

When you are viewing your app using the Web 2.0 Workbench, as you work with the app, in the DOM view are you seeing the updated/correct values including the JavaScript you are injecting from the server side?

_________________
Riyad
MyEclipse Support
 
 View user's profile Send private message Visit poster's website  
Reply with quote Back to top
wmstoval
Post subject:   PostPosted: Jul 30, 2008 - 09:16 PM



Joined: Apr 05, 2007
Posts: 30

I didn't realize I could wait till then to set breakpoints. But I set my AJAX preferences to suspend-at-start. And the debugger shows my html plus javascript when I start my javascript-debug launch configuration on the debug menu. The only enabled tools on the debugger toolbar are green/go and red/stop (no step into, etc). I double-click in the margin to set a breakpoint on the first line of code in the script tag and see visual confirmation that my breakpoint is set. Press the green/go and I don't hit that breakpoint.

Then I filled out a form on this page and hit Submit. The debugger did not stop at any subsequent page loads until I launched a new debug session.
 
 View user's profile Send private message Visit poster's website  
Reply with quote Back to top
support-rkalla
Post subject:   PostPosted: Aug 01, 2008 - 03:39 PM
Moderator
Moderator


Joined: Jan 06, 2004
Posts: 23305

Hmm it sounds like the JS debugger isn't digesting the new code right away coming back to it. I know we are doing a lot of work on JavaScript in 7.0, I'll make a note of us to check into this for that release. Sorry about the hickup.

Q: You know about using the browser view to browse to your particular page and then hitting the little "Bug" icon to start a debug session right there on that particular page right? (Might be an easier workflow for you)

_________________
Riyad
MyEclipse Support
 
 View user's profile Send private message Visit poster's website  
Reply with quote Back to top
Display posts from previous:     
Jump to:  
All times are GMT - 6 Hours
Post new topic   Reply to topic
View previous topic Printable version Log in to check your private messages View next topic
Powered by PNphpBB2 © 2003-2004 The PNphpBB Group
Credits