Debug JSP file

zhaozj2021-02-16  55

Debug JSP file

In Eclipse, you can debug Java class files, sometimes you will need to debug JSP files, but Eclipse does not support, although it is very convenient to debug JSP code in the JSP source file.

There is a good solution now, after your application server uses your Eclipse project as a working directory, Lomboz can make you debug the .java file generated by the JSP file on the application server.

Note: Lomboz only supports debugging on the application server capable of saving a copy of a servlet source code (.java) in the Eclipse source catalog.

Establish an example

Lomboz is a specific source file directory that is created in your project. When you complete the debugging work, you don't need to put the JAVA file generated by JSP into your module, so put these Java files and The true source code file is also necessary.

If you use Tomcat or JBoss, you must configure your application server as follows. BEA WebLogic has been inserted into the working directory in WebLogic.xml, so it is not necessary to make the following operations. This information must be deleted when you complete debugging.

In the JSP file being executed properly, the application server generates the corresponding Java class file, in order to separate these JAVA files generated by JSP and other Java class files, the application server will put these types of files in a called 'J2SRC 'The specific directory of'.

In WebLogic, all descriptions of the deploying web model have been configured (WebLogic.xml), however you can also change it according to the following description.

BEA WebLogic Server

WebLogic.xml in web application

Assume your project Under C: / Eclipse / Workspace, you need to correctly change this information for your Eclipse workbench.

CompileFlags -g KeepGenerated true WorkingDir C: / Eclipse / Workspace / Myj2eepROject / J2Src

Tomcat & Jboss

We need to set Tomcat to let it put the JSP generated Java file in the 'J2SRC' directory. The server.xml file ( /conf/server.xml) like this is like this, assumes that your project is under C: / Eclipse / Workspace, you need to change this information correctly. Important known issues: Tomcat4 The subdirectory of JSP files in the project Eclipse cannot compile the JSP generated servlet because there is no correctly containing the URL path org.apache.jsp. Solution: Download and install Sysdeo Tomcat 4.x Patchwww.sdeo. COM or you can use Tomcat3.3 that provides package definition. View class files and insert breakpoints

Eclipse usually does not automatically detect new files put in other programs (refer to the application server) in its project, in order to make your project synchronize with the JSP class file, you need to choose the J2SRC directory, then manually refresh, this will make you All JSP class files are displayed in the workbench. Next, you can insert a breakpoint for these class files.

Debugger

After inserting breakpoints, enter your JSP again (for example: http: // localhost: 7001 / myweb), you will find that the Eclipse debugger will stop in the place where you insert breakpoint. On this breakpoint, you can debug as a general debug.

Note: You must refresh your project to ensure that you have just compiled the generated JSP file.

转载请注明原文地址:https://www.9cbs.com/read-27293.html

New Post(0)