facebook

How to Debug JSP for real! [Closed]

  1. MyEclipse IDE
  2.  > 
  3. General Development
Viewing 10 posts - 1 through 10 (of 10 total)
  • Author
    Posts
  • #201428 Reply

    Hi!

    I’m trying to use MyEclipse to debug JSP’s.
    I was able to put a breakpoint in the JSP file (after copying the “jsp”.java generated by Tomcat 5.0). However when the breakpoint is reached, the ide jumps into the “jsp”.java file (the servlet), instead of staing in the .jsp file.
    Is it possible to do a real JSP debug in MyEclipse or it always goes to the servlet code?

    #201430 Reply

    SeJo
    Member
    #201438 Reply

    support-michael
    Keymaster

    Can you provide more info such as OS, appserver, where breakpoint is placed…?

    If your appserver does not support JSR045 then you will experience this problem. Also, JSP breakpoints set outside of a scriptlet will load the java src. We have an enhancement request to provide more src level filtering to minimize stepping into the low level java code.

    Michael
    MyEclipse Support

    #201448 Reply

    Here is my JSP

    <%@ page language=”java” import=”java.lang.*,java.util.*” %>
    <%
    String path = request.getContextPath();
    String basePath = request.getScheme()+”://”+request.getServerName()+”:”+request.getServerPort()+path+”/”;
    %>

    <!DOCTYPE HTML PUBLIC “-//W3C//DTD HTML 4.01 Transitional//EN”>
    <html>
    <head>
    <base href=”<%=basePath%>”>

    <title>My JSP ‘MyJsp.jsp’ starting page</title>

    <meta http-equiv=”pragma” content=”no-cache”>
    <meta http-equiv=”cache-control” content=”no-cache”>
    <meta http-equiv=”expires” content=”0″>

    <meta http-equiv=”keywords” content=”keyword1,keyword2,keyword3″>
    <meta http-equiv=”description” content=”This is my page”>

    <!–
    <link rel=”stylesheet” type=”text/css” href=”styles.css”>
    –>
    </head>

    <body>
    This is my JSP page. <br>
    ${10 * 15}
    <%
    Enumeration enum = request.getParameterNames();

    while (enum.hasMoreElements()) {
    String paramName = (String) enum.nextElement();
    out.println(paramName + “: ” + request.getParameter(paramName));
    }
    %>
    </body>
    </html>

    O put a breakpoint in line “String paramName = (String) enum.nextElement();”
    I’ve already done the procedure described “https://www.genuitec.com/forums/topic/debugging-jsps-with-tomcat-5-0-16-closed/&highlight=&#8221;

    I’m using “jakarta-tomcat-5.0.16”, JDK 1.4.1_03-b02, Windows 2000 SP4, Eclipse 2.1.2 [lastest version] and I had to include the following jars from Tomcat, in order to compile the “jsp”.java so I could Run:
    – jsp-api.jar
    – jasper-conpilar.jar
    – jasper-runtime.jar

    #201465 Reply

    OK here is all the information required by the forum:

    What operating system and version are you running? => Windows 2000 SP4
    What Eclipse version and build id are you using? (Help > About Eclipse Platform) => Version: 2.1.2, Build id: 200311030802
    – Was Eclipse freshly installed for MyEclipse? => Yes
    – Are any other external plugins installed? => No
    – How many plugins in the <eclipse>/plugins directory are like org.eclipse.pde.* => The default ones that came with eclipse
    What MyEclipse version are you using? (Help > About Eclipse Platform > Features) => My Eclipse 2.7 RC2
    What JDK version are you using to run Eclipse? (java -version) => 1.4.1_03-b02
    What JDK version are you using to launch your application server? => 1.4.1_03-b02
    What steps did you take that resulted in the issue? => Described in the previouse post
    What application server are you using? => jakarta-tomcat-5.0.16
    Are there any errors in the Eclipse log? (<workspace>/.metadata/.log) => No

    #201504 Reply

    Scott Anderson
    Participant

    I was able to put a breakpoint in the JSP file (after copying the “jsp”.java generated by Tomcat 5.0).

    You shouldn’t be copying anything generated by Tomcat anywhere. You don’t need to make your generated .java files part of your Eclipse project. Just use our JSP editor to open your JSP source file and set the breakpoint where you like. When you execute the JSP, the debugger should stop at the line specified on the breakpoint. Setting a breakpoint in the generated Java class will only make the debugger stop in the generated java class, as you requested when you set the breakpoint.

    By the way, Tomcat 5.0.16 has a bug and a workaround for JSP debugging is in this thread:
    https://www.genuitec.com/forums/topic/debugging-jsps-with-tomcat-5-0-16-closed/

    –Scott
    MyEclipse Support

    #201519 Reply

    OK, I removed the “jsp”.java generated by Tomcat from my project and the jars

    Now, when I access the JSP with a browser, I get this error “Source not found for MyJsp_jsp._jspService(HttpServletRequest, HttpServletResponse) line: 34”, that I thought that has because I needed the “jsp”.java.

    Since I don’t need the “jsp”.java generated by Tomcat, how do I fix the error?

    #201528 Reply

    Scott Anderson
    Participant

    Since you’ve obviously been experimenting a bit with this project I’d like to suggest that you set up a test project and walk through our web project tutorial to see how to set up a project and debug JSP’s with Tomcat 5. Once you’ve done that you should be able to apply the same techniques to your current project. The tutorial is in the MyEclipse User Guide in the help system and online here:
    http://myeclipseide.com/enterpriseworkbench/help/topic/com.genuitec.myeclipse.doc/html/gettingstarted/webtutorial.htm

    –Scott
    MyEclipse Support

    #201545 Reply

    OK, it was my fault.
    The answer was in SeJo post.
    I changed the web.xml wrong.
    After adding the “mappedfile” in the right place it finally worked.

    Thank you all.
    Now it’s time to buy. I’m going to upgrade my membership!

    #201548 Reply

    Riyad Kalla
    Member

    Antcasg,
    Glad to hear you got your problem worked out, come back if anything else is giving you trouble.

Viewing 10 posts - 1 through 10 (of 10 total)
Reply To: How to Debug JSP for real! [Closed]

You must be logged in to post in the forum log in