Use eclipse3 + lomboz to debug JSP

Source: Internet
Author: User
Reading this article Article Before that, please read the Illustration using eclipse3 + sysdeo Tomcat plugin to edit and debug JSP, which can deepen your understanding of this article. If you have other questions, refer to my blog-share Java.

Comparison between sysdeo eclipse Tomcat launcher plugin and lomboz plug-ins: Both plug-ins can use eclipse to develop JSP, but lomboz can also develop HTML and EJB. Sysdeo plugin loads Web applications by setting context, while lomboz loads Web applications by generating war files under the tomcat/webapps directory. Debugging JSP files in sysdeo plugin is simple because eclipse directly controls Web applications through context. In lomboz, eclipse indirectly controls the web application through the generated war file, or even does not control it. In sysdeo plugin, for example, the tomcatsample directory contains the work Directory, which is the working directory of JSP. Compile the JSP file into a Servlet File first, stored in the Work/org/Apache/jsp directory. For example, index. jsp generates the index_jsp.java file under the Work/org/Apache/jsp directory. In lomboz, the Work directory is stored in the Tomcat directory/work/Catalina/localhost.

Context description

The context element represents a web application and runs on a specific VM. Each web application is based on a web application archive (WAR) file or a directory that contains the decompressed content of the war file. By matching the longest possible prefix of the request URI with the context path of each context, Catalina selects the corresponding web application to process HTTP requests. Once selected, according to the servlet ing defined in the Web application deployment descriptor file, context selects a correct servlet to process incoming requests. Servlet mappings must be defined in/WEB-INF/Web. XML in the Web application directory hierarchy. You can nest any number of context elements in a host element. The path of each context must be unique and defined by the path attribute. In addition, you must define a context whose path length is 0. This context is called the default web application of the VM and is used to process requests that cannot match any context path. In addition to nesting the context element in the host element, you can also store them in a single file. put XML in the $ catalina_home/CONF/[enginename]/[hostname]/directory. (Note: Catalina is the alias of Tomcat)

The following uses an example to describe how to use lomboz to debug JSP.

Directory structure F:/j2sdk JDK directory

D:/eclipse directory F:/Java/Jakarta-Tomcat 5.0.28 Directory D:/plug-in/lomboz.301 lomboz directory (I installed it using links) make appropriate Configurations Based on the installed software. 1. In the eclipse window, window-> preferences-> lomboz-> server definitions, add jsper-runtime.jar, and then click application, OK ". 2. Create a lomboz project named lomboz debug web module name: debugweb server name: Tomcat 5.0.28 3. Modify the index. jsp file in the debugweb directory as follows:

Debugweb/index. jsp

<%
String S = "Welcome javamxj blog! ";
Out. println (s );
%>

4. Open the server. xml file under the $ tomcat_home/conf directory and add a statement below at the end of the file.

........ If the preceding statement is omitted, just add the following line: <context Path = "/debugweb" reloadable = "true" docbase = "D: /Eclipse/workspace/lomboz debug/debugweb "workdir =" D:/Eclipse/workspace/lomboz debug/j2src "/>
</Host> </engine> </service>

</Server>

 

 

Alternatively, create a new debugweb. xml file in the $ tomcat_home/CONF/Catalina/localhost directory. The content is as follows:

<? XML version = '1. 0' encoding = 'utf-8'?>
<Context Path = "/debugweb" reloadable = "true" docbase = "D:/Eclipse/workspace/lomboz debug/debugweb" workdir = "D: /Eclipse/workspace/lomboz debug/j2src "/>
</Context>
5. right-click the "lomboz debug" project, click "properties", and switch to "Java build path". Modify the following: 6. right-click the "debugweb" module and choose lomboz J2EE> debug server, Note: Do not select "run server" 7. Enter "http: // localhost: 8080/debugweb" in the browser window, OK! Edited successfully. 8. Refresh the j2src directory under the "lomboz debug" directory. You can see that there is an index_jsp.java file under this folder after refreshing. Double-click to open this file and add a breakpoint. 9. Refresh the browser window. At this time, eclipse will automatically switch to the "debug" view. 10. Then, the browser window Summary Debugging JSP with lomboz is more troublesome than sysdeo plugin. If you want to deploy a module, the deployed module will not be automatically decompressed because Tomcat will load the context first, therefore, the module can be automatically extracted only when the defined context is uninstalled.
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.