how to debug jsp and javascript file in eclipse? - javascript

My project containing java files, applets, jsp and javascript file. I am able to debug applet and java files But not able to configure the debug setup for jsp and javascript files in eclipse.
I tried debug using F12 tools throw browser IE10 but those files are not coming under the project.
please mention the steps for configuring the debug setup
Thanks,

Since the Javascript is executed on browser, Eclipse won't be able to debug it, unless it has some way to connect to the browser. You can try using AJAX Toolkit Framework, however, it's best to use internet browser's built-in debugger. You can also have a look at Aptana.
If your javascript files are not appearing in the IE debugger:
Check if the javascript files are included properly.
Try debugger on Chrome or Firefox (or with Firebug extension on
Firefox)
Also, you will not be able to place a debug pointer in JSP file unless it's placed in JAVA scriptlet part of JSP.

Related

How to run debug in VS Code so that it would launch Chrome in debug mode with paused .js scripts on HTML page?

Summary:
I got VS Code.
I got empty HTML template file in which i learn how to write js scripts.
VS Code has debugger, which can launch my file in Chrome for debugging (theoretically).
I set up breakpoints in file.
I can make debugger launch Chrome and open HTML file, but Chrome doesn't stop on breakpoints and runs whole script.
I cant pause scripts from VS Code. Unless i pause script from Chrome dev tools manually.
Question:
How to run debug in VS Code so that it would launch Chrome in debug mode with paused .js scripts on HTML page?
i mean, i really dont use something exotic like external scripts or environments or other stuff.
Its just a plain HTML template file, with 5-30 lines of .js script code in it. Nothing else. I would expect something so basic would be able to work "from the box" with a push of a button. But its not.
Suddenly, VSCode started using breakpoints properly now. Maybe there was some hotfix or something.
This is possible:
From the VSCode docs: https://code.visualstudio.com/docs/nodejs/browser-debugging
The simplest way to debug a webpage is through the Debug: Open Link command found in the Command Palette (Ctrl+Shift+P). When you run this command, you'll be prompted for a URL to open, and the debugger will be attached.

Debug JavaScript in IntelliJ IDEA

How can I debug JavaScript for my website in IntelliJ IDEA without changing my build configuration?
I am able to debug the JavaScript in Chrome Console but it does not work very well.
Answer. It is really easy:
Create a new JavaScript Debug Run configuration and specify the WAMP address you normally use to open your application in browser as URL there. See https://www.jetbrains.com/help/webstorm/2017.2/debugging-javascript-in-chrome.html#d45520e154 and linked topics.
You might also need to configure URL mappings in your configuration - https://www.jetbrains.com/help/webstorm/2017.2/debugging-javascript-deployed-to-a-remote-server.html#d46122e202
First you need to add intellij plugin for chrom and install it on chrom, then on configuration debug
you need to choose run with javascript.
I can show you screenshot if you want
It is worth noting that you should have linked separate .js files for debugging. I was trying to debug JavaScript code which was within an .html file but the breakpoints were never hit. I looked later under the resources in Chrome Inspector and found out that the lines were not synchronized between the files, because for the debugger the first line was the first JavaScript line, but for the html file it was the first line of the file (DOCTYPE)

How can I debug JavaScript code that is inside JSP page directly from IntelliJ IDEA?

I am working on a Java web application that implement its view using JSP.
Into this JSP I have some JavaScript functions that I want to debug. I know that I can do it using FireBug but I want know if I cand debug this JavaScript functions directly inside IntelliJ IDEA IDE.
It seems to me that I can debug the JavaScript inside HTML directly from IntelliJ (as shown here: https://www.jetbrains.com/idea/help/debugging-javascript.html).
But is it possible also for the JSP page? If it is possible how can I do it?
No, it's impossible. JSP is a server-side technology used by web servers running Java. JavaScript is a client-side technology used by browsers. The debugger can't use both of them simultaneously, or there should be two different debugging sessions that are running in the IJ, but I'm not sure if IJ support this feature. The only option is to use Remote Debugging, that you can use to connect to the running web server. In this way you can debug HTML page generated by the server. Even if that page is a result of JSP output you can't debug JSP in this debugging session.
In Eclipse you can debug JSP and it has nothing to do with server-side and client-side technologies. It doesnt work in Intellij in some cases depending on the type of project i.e. you can debug war and cannot debug jar in Intellij whereas it is possible in Eclipse

How to enable embedded javascript debugger in SWT browser?

I want to embed a JavaScript debugger in a SWT browser.
I'm using the SWT.MOZILLA flag for creating the browser. Since the JavaScript application I'm loading is complex, I need to have some JS debugger (any is suitable: firebug, venkman).
So, is there any way to embed a JS debugger in a browser widget?
I've heard about firebug-lite, but I don't know how to configure it in SWT. Could you give some working example?
See my answer on Using Firebug Lite in SWT Browser. The code snippet works with XULRunner 10.0.2 and Eclipse 4.2.
Output for XULRunner
http://getfirebug.com/firebuglite
Guess that you should try to add the firebug code to your script tag

Matching local javascript file to remote file for debugging in visual studio

I am working on a project in which javascript files are dynamically loaded into a page by the server using a python script. I am trying to use visual studio to debug these javascript files by attaching to the appropriate IE process for the loaded page and using the script debugger.
The problem is that IE and Visual Studio identify the dynamically loaded scripts like this:
scriptLoader.py?get=Utils
but Visual Studio identifies the javascript source file like this:
Utils.js
Because of this, VS doesn't recognize these as being the same source and the only way I can debug is to cause an exception to occur so that IE opens VS and loads the copy that was served to the browser.
Is there any way to force VS to recognize that Utils.js and scriptLoader.py?get=Utils are the same source?
I don't know of a way to do what you're describing, but you can always just use this nice line:
debugger;
which will cause the debugger to load on the specified line.

Categories