Graphical use Eclipse3 + Lomboz debugging JSP

xiaoxiao2021-03-06  92

Before reading this article, please read "

Graphical uses Eclipse3 Sysdeo Tomcat Plugin editing and debugging JSP, you can deepen your understanding of this article. If you have any other questions, please refer to my blog -

Share java happiness.

Comparison of Sysdeo Eclipse Tomcat Launcher Plugin and Lomboz Plugins:

Both plugins can use Eclipse to develop JSP, but Lomboz can also develop HTML, EJB, etc.

Sysdeo Plugin is loaded with a web application by setting up CONTEXT; and Lomboz is loaded with WAR files generated in the Tomcat Directory / WebApps directory.

The Sysdeo Plugin debugging JSP file is relatively simple because Eclipse directly controls web applications through Context.

In Lomboz, Eclipse is indirectly controlled by the generated WAR file, and can even say that there is no control.

In sysdeo plugin, such as the TomcatSample directory contains a work directory, this directory is a JSP working directory, first compile the JSP file into a servlet file, store it in the Work / ORG / Apache / JSP directory. Such as index.jsp generates index_jsp.java files in the work / org / apache / jsp directory.

In Lomboz, the Work directory is stored in Tomcat Directory / Work / Catalina / Localhost.

Context explanation

The Context element represents a web application and runs on a particular virtual host. Each web application is based on a Web Application Archive (WAR) file, or a directory containing the content after the WAR file is decompressed.

Match the URI's maximum possible prefix with each context path, Catalina selects the corresponding web application to process HTTP requests. Once selected, according to the servlet map defined in the Web Application Deployment Descriptor file, Context selects a correct servlet to handle the request. The servlet mapping must be defined in /web-inf/web.xml in the web application directory hierarchy.

You can nest any of the context elements in a host element. The path to each context must be unique and defined by the Path property. In addition, you must define a context path length of 0, which is called the default web application of the virtual host to handle those 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 (in .xml as a suffix), place below the $ CATALINA_HOME / CONF / [Enginename] / [Hostname] / directory.

(Note: Catalina is Tomcat notior)

Let's talk about how to debug JSP with Lomboz with an instance.

Directory Structure

F: / j2sdk jdk directory

D: / eclipse eclipse directory

F: / java / jakarta-tomcat tomcat 5.0.28 directory

D: /plug-in/lombo.301 Lomboz Directory (I use a links method here

Installed)

Based on the installed software, make a suitable configuration.

1. In the Eclipse window, window -> Preferences -> Lomboz-> Server Definitions, add jsper-runtime.jar, and finally click "Apply", "OK".

2. Create a new Lomboz project

Project Name: Lomboz Debug

Web Module Name: DebugWeb

Server name: Tomcat 5.0.28

3. Modify the index.jsp file under the DebugWeb directory as follows:

Debugweb / index.jsp <% string s = "Welcome JavaMxj Blog!"; OUT.PRINTLN (S);%>

4. Open the Server.xml file below the $ TOMCAT_HOME / Conf directory, add a statement to the end of the file.

........ The above statement is omitted

As long as you add the following line

Or, $ Tomcat_Home / conf / catalina / localhost directory newly created a debugweb.xml file, as follows:

5. Right-click on the "Lomboz Debug" project, click "Properties", switch to "Java Build Path", modify as follows:

6. Right-click "DebugWeb" module -> Lomboz J2EE -> Debug Server,

Note: Don't choose "Run Server"

7. Enter "http:// localhost: 8080 / debugweb" in the browser window, OK! Edited success.

8. Refresh the J2SRC directory under the "Lomboz Debug" directory, you can see the refresh, there is an index_jsp.java file under this folder,

Double-click to open this file and add a breakpoint.

9. Refresh the browser window, then Eclipse automatically switches to the "debug" view,

10. At this point the browser window

summary

Using the Lomboz debugging JSP to trouble more than Sysdeo Plugin, and if you want to deploy modules, the deployed module will not automatically decompress because Tomcat will first load context, so only the defined context can automatically decompress the module.

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

New Post(0)