Eclipse + lomboz + Tomcat = jsp/Servlet

Source: Internet
Author: User
2008-08-25 Eclipse + lomboz + Tomcat = jsp/Servlet

Address: http://www.sudu.cn/info/html/edu/jsp/20071227/51714.html

Here, I wrote almost all the same as the three excellent articles on the http://blog.csdn.net/dawave, here thanks to the hard work of dawave, I want to make a summary here. I don't know whether there is any infringement. If not, please tell me that I don't want to give it a name.

No nonsense. Go to the topic.

First, you must have the following software:
1. JDK: http://java.sun.com/j2se/1.4.2/download.html
2. Eclipse plaform SDK: http://www.eclipse.org/downloads/index.php
3, lomboz: http://forge.objectweb.org/project/download.php? Group_id = 97 & file_id = 2302.
4, EMF runtime: http://www.eclipse.org/emf/
5, Tomcat: http://jakarta.apache.org/site/binindex.cgi

The software versions I use are as follows:
JDK v1.4.2 _ 05
Eclipse v3.0.1
Lomboz v3.0.1
EMF runtime v2.0.1
Tomcat v5.0.28

In addition to JDK installation, the above software can be directly decompressed for installation. Among them, lomboz requires EMF support, while lomboz and EMF runtime are directly decompressed to the eclipse directory. Note that the decompressed directory structure should be the same as that of Eclipse. Now we assume that the installation location of each software is:

JDK: C:/Java
Eclipse: D:/eclipse
Tomcat: C:/tomcat

Make sure that Tomcat runs normally independently.

To configure environment variables after installation, you need to add and modify the following (this is the configuration on my machine ):

Java_home: "C:/Java"
Tomcat_home: "C:/tomcat"
Classpath: ".; C:/Java/lib/dt. jar; C:/Java/lib/tools. Jar" must be added at the beginning to indicate the current directory.
Path: "% SystemRoot %/system32; % SystemRoot %/system32/WBEM; C:/Java/bin"

After the preceding steps are completed, start eclipse and go to Windows> preferences. You should be able to see the lomboz option on the left. If not, the reason is generally that the unzipping is correct or the EMF Runtime is not installed. Follow the configuration below to remember to click the Apply button after modification.

Build path and change source and Output Folder to the folers option.

Lomboz preferences: Change JDK tool. jar to the tool. Jar location of your machine.

Server
Definitions, change server type to Tomcat v5.0.x, and then on the Properties tab
Change the Server Directory to the tomcat installation path, and the classpath variable is the same.

Convert to server classpath. Here we add the jar files under $ tomcat_home $/common/lib. This is what I saw in another article. In fact, it can be run without adding these files, I don't know what the difference is.

To convert to project classpath, according to dawave, The jasper-runtime.jar must be added; otherwise JSP cannot be debugged.

The above is the configuration of the entire R & D environment. The following is the configuration of the project.

New-> Project-> lomboz J2EE project. Enter the project name. Here, the location of the project can be modified. I will not change it. Now, assume the project name is test, and click Next.

You do not need to modify the things in step 2. Click Next and go directly to Step 3. Add the project name in web modules, that is, the future project directory name.

Convert to targeted servers, add Tomcat v5.0.x to the List, and click Finish.

After creating a project, you can view the new project in the package explorer of eclipse. Right-click the project and choose Properties> JAVA build path.

1. Select allow output folders for source folders.
2. Change the default Output Folder to the classes directory under the project web-INF. This is where Tomcat puts the class document by default.
3. Change the Output Folder under j2src to his/her own.

Now that the entire project has been configured, we can start to configure JSP debugging.

For convenience, I directly use the index. jsp automatically generated by the project.

What we need to do is to create an XML document under $ atat_home $/CONF/Catalina/localhost. The document name is not limited and the content is as follows:

<Context
Path = "/test" docbase = "D:/Eclipse/workspace/test" reloadable = "true"
DEBUG = "0" workdir = "D:/Eclipse/workspace/test/j2src"/>

You must modify the directory name.

Start tomcat in eclipse, which is completed in the lomboz J2EE view panel. After selecting the project, start the server with the gear.

Because debugging JSP is actually to debug the servlet generated by it, we need to run JSP first, that is, open the JSP in the browser and enter http: // localhost: in the browser: 8080/test. The running result is as follows:

After running, you can return to eclipse. Refresh the project in package explorer and you will be able to see something under j2src. Expand the directory. index_jsp.java is the index. open the servlet generated by JSP by double-clicking it, and you will be able to configure the breakpoint here. Then, refresh the original page in the browser and it will not be displayed, but eclipse in the taskbar will flash through, in the past, the servlet was stopped at the breakpoint.

Well, it's a very powerful R & D environment. I liked her at the beginning.

The following are some of my own problems (I'm afraid I can't remember how to solve them, so I will write them down ):

1. Tomcat cannot be started in eclipse.

Because I use the latest online version, this problem seems inevitable. The solution was found at dawave:

Open the tomcat50x. Server File under the D:/Eclipse/plugins/COM. objectlearn. jdt. j2ee_3.0.1/servers directory and find

-Djava. endorsed. dirs = "$ {serverrootdirectory}/bin; $ {serverrootdirectory}/common/endorsed"

Remove the previous $ {serverrootdirectory}/bin. There are two areas in total.

-Djava. endorsed. dirs = "$ {serverrootdirectory}/common/endorsed"

Original in http://forge.objectweb.org/forum/forum.php? Thread_id = 1028 & forum_id = 360

2. The new XML document does not work.

After entering http: // localhost: 8080/test in the browser, the following message is displayed:
-------------------------------------------------------------------
Type status report

Message/test

Description the requested resource (/test) is not available.
-------------------------------------------------------------------
This problem has been depressing for a long time. I think it is the format of the XML document.

<Context
Path = "/test" docbase = "D:/Eclipse/workspace/test" reloadable = "true"
DEBUG = "0" workdir = "D:/Eclipse/workspace/test/j2src"/>

The beginning of this line
The context must be case sensitive. Although I have seen a lot of people on the internet write all in uppercase, I only need to change it to that, and even docbase and workdir should also be noted.
Case sensitive. Later, I thought, since other people can use uppercase letters, but I can't, Will Tomcat have an option to switch whether the keywords in the XML document are case sensitive? Alas, I have not studied it carefully,
I don't know much about it.

I have finished writing and have never written so long. I would like to thank all the experts who have selflessly contributed their experiences on the Internet, especially dawave's essays. I have studied those articles for a long time. Alas, your level is too low

I want to continue my JSP journey

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.