Using Lomboz debugging JSP Foxgemm (original) Keywords Java JSP Eclipse Lomboz
Debug JSP using Lomboz
Ube bun (james.hu@chinacodeline.com)
Xi'an Software Co., Ltd.
September 2003
Introduction, all people with JSP write experience have experience in JSP debugging. Since the lack of automated debugging tools makes a lot of print statements that have to be used in the file when debugging JSP. This approach is a simple and effective means for the location of the JSP range, but how to quickly and efficiently position the internal error of the object called in the JSP. It is a bit unhappy. Because this will have to compile, release, start and stop the server, bringing great inconvenience to debugging. The Legend of the JSP debugging tools you have obtained, don't exist on the situation currently mastering. If the reader has the hope of this information, huh, huh. But JSP debugging tools do exist, and it is free! IT's Lomboz. Download address: http://www.objectlearn.com/products/download.jsp This article uses Lomboz to debug JSP from a simple example. The development environment of this example is as follows: - JDK Version: 1.4.1; - Java IDE: Eclipse 2.1; - Lomboz: Suitable for Eclipse2.1 plugin; - JSP / Servlet Container: Tomcat 4.1.18. Introduction to Lomboz
Strictly said that Lomboz is a J2EE plugin for Eclipse. It integrates many Java application servers, J2EE components, and web applications to Eclipse, which can help Java developers use Eclipse to build, test, deploy J2EE applications. For the focus of this article, JSP debugging, it also has related support: - Support JSP write, including: syntax coloring and syntax check; - Support JSP debugging. For JSP debugging, the principle of Lomboz is to debug the Java code generated by the JSP page to be debugged. The entire debugging process is the same as the debugging process of the Java application, whether it is a JSP itself debugging or a debugging of the object called by JSP, it is seamlessly coupled to a piece. Before you begin this article, let's first look at the Lomboz installation and configures for normal use of its JSP debugging.
Installing and configuring the Lomboz installation process is very simple. Most of the Eclipse plug-in installation process is very simple. The main steps are as follows: 1. Download from Lomboz (http://www.objectLearn.com/products/download.jsp) Supports plugins for Eclipse2.1 (or other versions of Eclipse). 2. If the Eclipse has run, then turn it off first. 3. Extract the downloaded file to the plugins directory in the Eclipse installation directory. 4. Restart Eclipse to open "About Eclipse Platform Plug-Ins" (Help -> About Eclipse Platform -> Plug-in Details), if the Lomboz installation will appear information about it. As shown below:
Note: If you want to remove Lomboz, you only need to delete the directory of the PLUGINS directory.
5. Set the Lomboz J2EE View, open Window -> Customize Perspective, as shown in Figure Set: How to configure Lomboz to make it work properly. Contrary to the installation process, the configuration process is not that simple, J. The Lomboz configuration steps are as follows: 1. Configure JDK, select "Windows -> Preferences", select Lomboz, and configure the JDK. This is as follows:
2. Define the server if your server is already included in the Lomboz default server list, this step can be skipped. The Lomboz default server list can be obtained by expanding Lomboz in the previous interface, then select "Server Definitions". The following is to add Tomcat4.1.18 as an example to show how to add a server. The relevant steps are as follows: a) Enter the servers subdirectory of the Lomboz installation directory, copy one .server file (such as Tomcat410.server) and renamed Tomcat418.server. b) Open this file to change the following locations of this file: -
c) Add Jasper-Runtime.jar. By default, only 2 JAR files are included in the Tomcatx.Server file: servlet.jar and bootstrap.jar, but lack jasper-runtime.jar. And this JAR file has played a very important role in JSP debugging, so please add it. There are two ways to add JAR to a server: Method 1: Add a line in the
Note: For Tomcat4.x servers need to put patch to make Lomboz work, patch download address: http://www.sysdeo.com/, the Lomboz installation and configuration has been completed, let us create a "" Hello World! "Examples to experience the process of debugging the JSP.
Debug JSP creation project
To use Lomboz debugging JSP, you must first create a Lomboz project. The steps are as follows: 1. Open file-> new-> Lomboz J2EE Project, create a project called debugjsp; 2. Select "Next" to enter the Lomboz Engineering Property Select page, add web modules and the server used. Since our main task is to debug JSP, the EJB module can be empty. As shown below:
3. Choose Finish, Lomboz project is created. At this point, the file structure generated by Lomboz is shown below:
Next, we can create the JSP file you need. In this example I use the default index.jsp, change its content to:
2. Create a corresponding subditio structure in the corresponding J2SRC directory, and set the J2SRC as the Source directory of the J2SRC. Grammar check Now, let's start to enjoy the process of debugging JSP. The JSP should be no syntax error before debugging. Lomboz provides the function of the JSP syntax check. The specific operation is: 1. Select the JSP file to perform syntax check, click the right mouse button; Solve logic errors. This error can only be solved by debugging. Using the Lomboz debugging process is very similar to the debugging of a normal Java application, because its principle is to use the server to generate a JAVA file corresponding to the JSP, and then debug them. The steps to debug JSP are as follows: 1. Open the Lomboz J2EE View, select the server, click the right mouse button to select "Debug Server". As shown in: If the .server file is defined correctly, Tomcat will start. If you don't start Tomcat as expected, then troubleshoot from these two aspects: Tomcat environment variables and Lomboz Server files. 2. Open the browser, such as IE, enter: http://127.0.0.1: 8080 / debugjsp / index.jsp. If the JSP file syntax does not have an error, the JAVA file corresponding to this JSP file will be generated in the J2SRC / ORG / APACHE / JSP directory. Refresh the project to see these files. Figure:
This step is mainly to trigger the server based on JSP's Java files that can be debugged, do not have to be precise. Because once the Java file is generated, these errors can be excluded by debugging. 3. Open this Java file, set the breakpoint in it, then enter this URL again in the address bar of the IE. At this time, the Eclipse debugging function is activated. At this point, JSP can be commissioned, and the situation is as follows:
As for the debugging of the object called the JSP, after completing the above steps, then set the breakpoint in the Java file corresponding to the object.
Conclusion Although the current JSP debugging is not convenient to be as convenient as ordinary Java files, the occurrence of the Lomboz tool has at least the stage of manual debugging JSP. Since this Java's web application developer does not have to stop the program from time to time to manually add a printed statement to observe the value of the variable, the opposite can observe the changes in the program while debugging the normal Java app. This greatly facilitates the development of web applications, which reduces the time to be wasted for debugging. References L Jiang Yan's "Using Eclipse Development J2EE Application" introduced how to develop J2EE apps using Lomboz; L Lomboz's official website www.objectlearn.com, there is Lomboz documentation and related tutorial; l Eclipse's official website WWW. Eclipse.org; L Eclipse in action, a good book on Eclipse in an item; L Tomcat's official website http://jakarta.apache.org/tomcat/index.html;