PrefaceAnyone with JSP coding experience may experience JSP debugging difficulties. Due to the lack of automated debugging tools, JSP debugging has to use a large number of print statements in files. This method is a simple and effective method for locating errors within the JSP scope, but it seems a little powerless to quickly and effectively locate internal errors of objects called in JSP. This will cause frequent compilation, release, and start/stop of servers, causing great inconvenience to debugging. The legendary JSP debugging tool does not exist as far as I know it. If the reader wishes to inform him of this information, haha. However, JSP debugging tools do exist, and they are free of charge! It's lomboz. :Http://www.objectlearn.com/products/download.jspThis article describes how to use lomboz to debug jsp from a simple example. In this example, the development environment is as follows:-JDK version: 1.4.1;-Java ide: Eclipse 2.1;-lomboz: plug-in for eclipse2.1;-JSP/servlet container: Tomcat 4.1.18.Lomboz IntroductionStrictly speaking, lomboz is a J2EE plug-in of eclipse. It integrates many Java application servers, J2EE components, and Web application development into eclipse, java developers can use eclipse to create, test, and deploy J2EE applications. For the focus of this article, JSP debugging also supports:-JSP writing, including syntax coloring and syntax check;-JSP debugging is supported. For JSP debugging, The lomboz principle is to debug the Java code generated on the JSP page to be debugged. The entire debugging process is the same as the debugging process of the Java application. In this way, the debugging of JSP debugging and the debugging of JSP called objects are seamlessly linked. Before starting the example in this article, let's take a look at lomboz installation and configuration for normal use of its JSP debugging function.Installation and configurationLomboz installation process is very simple, most Eclipse plug-ins are very simple, the main steps are as follows: 1. From lomboz (Http://www.objectlearn.com/products/download.jspDownload plug-ins that support eclipse2.1 (or other versions of eclipse. 2. If eclipse is running, close it first. 3. decompress the downloaded file to the Plugins directory under the eclipse installation directory. 4. restart eclipse and open "about eclipse Platform Plug-ins" (Help-> about eclipse platform-> plug-in details). If lomboz is installed successfully, information about it will appear. For example, note: to remove lomboz, you only need to delete the lomboz directory under the Plugins directory. 5. Set lomboz J2EE view, open window-> customize perspective, and set: Next, how to configure lomboz to make it work normally. In contrast 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", and select lomboz for JDK configuration. Example: 2. Define the server. skip this step if your server is already included in the lomboz default server list. Lomboz default server list can be obtained by expanding lomboz in the interface in the previous step, and then selecting "server definitions. The following uses tomcat4.1.18 as an example to describe how to add a server. Perform the following steps: a) enter the servers subdirectory of the lomboz installation directory, copy A. Server File (such as tomcat410.server), and rename it atat418.server. B) open the file and change the following locations of the file:-<serverdefinition ...... />, Change the name value to the name you want (for example, Apache Tomcat v4.1.8). This name is used to display the server list on the "server definitions" interface; -<property id = "serverrootdirectory "...... />, Where the default value is changed to the directory where Tomcat is located on your machine, such as D:/program files/Java/tomcat-4.1.18;-<property id = "classpathvariablename "...... />, Where the default value is changed to any name (such as tomcat418), which is used to represent the default classpath variable name of the lomboz project;-<property id = "classpath "...... />, Where the default value is changed to the Tomcat directory on your machine, such as D:/program files/Java/tomcat-4.1.18; c) Add jasper-runtime.jar. By default, the tomcatx. Server File contains only two jar files: servlet. jar and bootstrap. jar, but lacks the jasper-runtime.jar. This jar file plays an important role in JSP debugging. Therefore, add it. There are two ways to add a jar to a server: Method 1: In the edited. add a line in the <serverclasspath> section of the Server File: <jar type = "variable" >$ {classpathvariablename}/common/lib/jasper-runtime.jar </jar>; Method 2: use the server definitions interface. The configured server is displayed in the "server definitions" form. For example, Note: To enable lomboz to work properly, install patches on servers of Tomcat 4.x:Http://www.sysdeo.com/So far, lomboz installation and configuration have been completed, so let's create a "Hello world !" Let's take a look at the process of debugging JSP by lomboz.Debug JSPCreate a projectTo debug JSP with lomboz, you must first create a lomboz project. The procedure is as follows: 1. open File-> New-> lomboz J2EE project and create a project named debugjsp; 2. select "Next" To Go To The lomboz project attribute selection page and add the web module and the server used. Because our main task is to debug JSP, The EJB module can be empty. For example, 3. Select finish. The lomboz project is created. At this point, the file structure generated by lomboz is as follows: Next, we can create the desired JSP file. In this example, I directly use the default index. jsp and change its content to: <! -- Copyright (c) 2002 by objectlearn. all rights reserved. --> <HTML> Syntax checkNow, let's start to enjoy the JSP debugging process. Before debugging, JSP should have no syntax errors. Lomboz provides the JSP syntax check function. The specific operations are as follows: 1. Select the JSP file for the syntax check and right-click it; 2. Select lomboz J2EE... -> Check JSP syntaxDebuggingAfter resolving the syntax error, the next step is to solve the logic error. This error can only be solved through debugging. The process of using lomboz to debug JSP is similar to that of common Java applications, because the principle of lomboz is to use the server to generate the corresponding Java file of JSP, and then DEBUG them. To debug JSP, follow these steps: 1. Open lomboz J2EE view, select a server, and right-click and choose debug server ". If the. Server File is correctly defined, Tomcat will start. If Tomcat is not started as expected, troubleshoot these two problems: Tomcat environment variables and lomboz server files. 2. Open your browser, such as IE, and enter:Http: // 127.0.0.1: 8080/debugjsp/index. jsp. If the JSP File Syntax is correct, the Java file corresponding to the JSP file will be generated under the j2src/org/Apache/jsp directory of the project. Refresh the project to view these files. This step mainly triggers the server to generate java files for debugging Based on JSP, so you don't have to worry too much about whether the results are correct. Once a Java file is generated, these errors can be ruled out through debugging. 3. Open the Java file, set the breakpoint, and enter the URL again in the address bar of IE. At this time, the debugging function of eclipse is activated. Now we can debug the JSP in a targeted way. In this case, as for the debugging of the JSP called object, after completing the above steps, we can set a breakpoint in the corresponding Java file of the object.ConclusionAlthough JSP debugging is not as convenient as debugging for common java files, the appearance of tools such as lomboz has ended at least the manual debugging of JSP. Since then, Java Web application developers do not have to stop the program from time to time due to some errors to manually add print statements to observe the value of the variable, on the contrary, they can observe the changes of these values while running the program just like debugging a common Java application. This greatly facilitates the development of web applications and reduces the time wasted on debugging.ReferencesL Jiang Weiwei's "using eclipse to develop J2EE applications" describes how to use lomboz to develop J2EE applications; l lomboz's official websiteWww.objectlearn.comThere are lomboz documents and related tutorials; l eclipse Official WebsiteWww.eclipse.org; L eclipse in action, a good book about eclipse; l Tomcat's official websiteHttp://jakarta.apache.org/tomcat/index.html;