MyEclipse Forums
Post new topic   Reply to topic
View previous topic Printable version Log in to check your private messages View next topic
Author Message
dwise
Post subject: JavaScript debugger not working when app uses Struts  PostPosted: Jan 06, 2006 - 07:05 PM
Registered Member
Registered Member


Joined: Sep 04, 2005
Posts: 2

I have an application that uses struts. So I have a URL like

/myapp/home.do

But then I have some JavaScript in {project}/web/home.jsp (which is the view for the URL home.do). I have tried to debug this javascript, but the debugger never stops on the break points.

If I move the HTML + JavaScript into a .html file where the URL in the browser

home.html

matches the file in the project

home.html

the debugger begins working. Is there a problem with the debugger detecting that it should stop when the address line does not match the file name?

Also, is there any documentation for the debugger? I have only found it discussed on the "what's new" pages. I found nothing in the help off the Eclipse help menu.

Thanks!
 
 View user's profile Send private message Visit poster's website  
Reply with quote Back to top
support-greg
Post subject:   PostPosted: Jan 07, 2006 - 06:19 AM
Moderator
Moderator


Joined: Mar 31, 2004
Posts: 1612

Currently the debugger will only stop for breakpoints in javascript and html files. JSP and other dynamic files will be support in future releases but we are still working on that. Many appservers don't preserve line number entirely correct when trying to map to javascript source. So that is still in progress.

However you should be able to debug javascript in your struts page by placing all of your javascript in an external .js file and then just linking it into your page with script tag:
Code:
<script type="text/javascript" src="file.js"></script>


Also, regarding documentation, take a look at the JavaScript Development and Debugging quickstart.
http://www.myeclipseide.com/images/tutorials/me_remote_doc/javascript/
This document should also be in the MyEclipse Help integrated into our product.

The quickstart goes over many of the current features. However it doesn't show debugging a deployed webapplication but the process if very similar to that of local html files. Just type in the URL.

_________________
Greg
MyEclipse Support
 
 View user's profile Send private message Visit poster's website  
Reply with quote Back to top
warrenthebrown
Post subject:   PostPosted: Jan 30, 2006 - 08:59 PM
Registered Member
Registered Member


Joined: Apr 26, 2005
Posts: 19

Adding <script language="javascript" src="js/common.js" charset="UTF-8"></script> to our jsp file still does not cause myeclipse to stop at breakpoints in common.js. But breakpoints in the Java code in the jsp file our recognized. Running against Tomcat 5.5.

Any other ideas?
 
 View user's profile Send private message Visit poster's website  
Reply with quote Back to top
support-rkalla
Post subject:   PostPosted: Feb 04, 2006 - 01:56 AM
Registered Member
Registered Member


Joined: Jan 06, 2004
Posts: 23824

Warren,
I tried to duplicate your problem and was unable to, please have a look at my demo application here and see if I did what you were talking about. I created an action forward for home.do to home.jsp. I also duplicated the page into home.html. Then I tried debugging the Javascript with it IN the page (in the header) for all 3 types (.do, .jsp, .html) and it worked. Then I created an external file and put the JS in there, and set a breakpoint and commented out the JS from the pages and then tried debugging all 3 types again and it worked there as well.

Can you try and reproduce my steps and set a breakpoint on the line inside the statement that sets the color?

_________________
Riyad
MyEclipse Support
 
 View user's profile Send private message Visit poster's website  
Reply with quote Back to top
warrenthebrown
Post subject:   PostPosted: Feb 07, 2006 - 07:13 PM
Registered Member
Registered Member


Joined: Apr 26, 2005
Posts: 19

Thank you for your response. If I right click on your html file and execute via javascript debugger, I can set breakpoints that work.

However, now I must show my ignorance. We have a pretty large build procedure for generating and deploying things for our app which was imported awhile some time ago from JBuilder. So, I have not been able to figure out how to build/deploy/invoke a .do file from your .jsp file in order to test the javascript debugging. (I currently have tomcat 5.5, but could use jboss, or ...) Would you give me the steps I need to do that. Many thanks for your patience and assistance in helping me understand more of Eclipse/Myeclipse capabilties for what should be a simple thing for me to do.
 
 View user's profile Send private message Visit poster's website  
Reply with quote Back to top
support-rkalla
Post subject:   PostPosted: Feb 07, 2006 - 07:20 PM
Registered Member
Registered Member


Joined: Jan 06, 2004
Posts: 23824

.do is the extension mapped to struts, you just type it into your browser. You can then see where that will take you by viewing the struts-config.xml file. For example /home would be accessed using /home.do

The server see's the .do extension, goes "Oh that's mapped to ActionServlet" and hands it off to Struts. Then Struts rips the .do off of it, looks at it, /home, and checks the struts-config.xml file for a match, finds it, and sends the user there. In this case, the home.jsp file.

_________________
Riyad
MyEclipse Support
 
 View user's profile Send private message Visit poster's website  
Reply with quote Back to top
warrenthebrown
Post subject:   PostPosted: Feb 07, 2006 - 07:28 PM
Registered Member
Registered Member


Joined: Apr 26, 2005
Posts: 19

Thanks. I guess I knew that, but somehow did not do it.

I can set breakpoints in your rollover.js file in the project directory, but cannot set breakpoints in the rollover.js file in the deployment directory which is where I suspect they need to be set. What am I missing?
 
 View user's profile Send private message Visit poster's website  
Reply with quote Back to top
support-rkalla
Post subject:   PostPosted: Feb 07, 2006 - 08:08 PM
Registered Member
Registered Member


Joined: Jan 06, 2004
Posts: 23824

Quote:

Thanks. I guess I knew that, but somehow did not do it.

Keeping all this stuff straight is a full time job.

Quote:

I can set breakpoints in your rollover.js file in the project directory, but cannot set breakpoints in the rollover.js file in the deployment directory which is where I suspect they need to be set. What am I missing?

You shouldn't be worried about the deployment directory. Just set breakpoints in the files in your project, when you debug it, part of the communication between the server and MyEclipse that takes place tells MyEclipse *where* you are in the execution, so MyEclipse can break for you at those points.

It's all a lot of black magic :)

_________________
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