Debug JSP files in eclipse

Source: Internet
Author: User
Tags jboss

In eclipse, You can debug java files. Sometimes you also need to debug JSP files, but eclipse does not support it, although debugging JSP code in JSP source files is very convenient.

Now there is a good solution. After you tell the application server to use your Eclipse project as the working directory, lomboz allows you to generate JSP files on the application server. debug the Java file.

Note: lomboz only supports debugging JSP on the application server that can save a copy of The Servlet Source Code (. Java) in the eclipse source code directory.

Create an instance

Lomboz creates a specific source file directory j2src for you in your project. After debugging, you do not need to put the Java file generated by JSP into your module, therefore, it is necessary to separate these java files from real source code files.

If you are using tomcat or JBoss, to debug the JSP file, you must configure your application server as follows. BEA WebLogic has inserted the working directory information in weblogic. XML, so you do not need to perform the following operations. You must delete this information when debugging is completed.

During normal execution of JSP files, the application server generates corresponding Java class files. In order to separate these JSP-generated Java class files from other Java class files, the Application Server places these class files in a specific directory named % 26 lsquo; j2src % 26 rsquo.

In WebLogic, all descriptions of deploying the web model have been correctly configured (weblogic. XML). However, you can change it according to the instructions below.

BEA WebLogic Server

Weblogic. XML (myweb) in Web Applications)

Assume that your project is in c: \ eclipse \ workspace, and you need to change the information correctly for your eclipse workbench.

Compileflags

-G

Keepgenerated

True

Workingdir

C:/Eclipse/workspace/myj2eeproject/j2src

Tomcat % 26amp; JBoss

We need to set tomcat to put the Java file generated by executing JSP into the % 26 lsquo; j2src % 26 rsquo; directory.

Edit the Tomcat server. xml file ( \ Conf \ Server. XML)

Assume that your project is in c: \ eclipse \ workspace, and you need to change the information correctly for your eclipse workbench.

Docbase = "c: \ eclipse \ workspace \ My J2EE project \ myweb"

Workdir = "c: \ eclipse \ workspace \ My J2EE project \ j2src"/>

Important known issues:

Tomcat 4 and the subdirectory of JSP files in the project

Eclipse cannot compile the servlet generated by JSP, because the package definition of the JSP file does not correctly contain the URL path org. Apache. jsp.

Solution:

Download and install sysdeo Tomcat 4.x patch
Www.sysdeo.com

Alternatively, you can use Tomcat 3.3.

View class files and insert breakpoints

Eclipse usually does not automatically detect new files put into other programs (here, the application server) in its project. To synchronize your project with JSP files, you need to select the j2src directory, then refresh manually, which will display all JSP class files in your workbench. Next, you can insert breakpoints for these class files.

 

Debugger

After the breakpoint is inserted, enter your JSP (for example, http: // localhost: 7001/myweb) again. You will find that the eclipse debugger stops at the place where the breakpoint is inserted. On this breakpoint, you can perform debugging like the normal debugging.

Note: You must refresh your project to ensure that you can access the JSP file generated in the compilation.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.