Graphical use Eclipse3 Sysdeo Tomcat Plugin editing and debugging JSP (1) graphic using Eclipse3 Sysdeo Tomcat Plugin editing and debugging JSP (2) 5. Editing Servlet programs
On the basis of successful editing and debugging JSP, it is relatively simple to edit and debug the servlet program.
1. Stop the Tomcat server first. Right click on the "Web-INF / SRC" directory, create new -> class,
Fill in the package name: "javamxj.tomcat.servlet"
Fill in the class name: "servletsample"
Click to complete.
2. Modify servletsample.java as follows:
Servletsample.java
/ *
* Create date 2004-10-18
* Author javamxj (9cbs blog)
* /
Package javamxj.tomcat.servlet;
Import java.io. *;
Import javax.servlet.http. *;
Import javax.servlet. *;
Public class servletsample extends httpservlet {
PRIVATE STRING S;
Public void doget (httpservletRequest Req, httpservletResponse res)
Throws ServleTexception, IOException
{
PrintWriter out = res. maxwriter ();
String s = "Hello, JavaMxj Blog!";
Out.println (s);
Out.close ();
}
}
3. Create a web.xml file in the web-inflicity, save the file.
WEB-INF / Web.xml
Xml Version = "1.0" encoding = "ISO-8859-1"?>
XMLns: XSI = " http://www.w3.org/2001/xmlschema-instance " XSI: SchemAlocation = " http://java.sun.com/xml/ns/j2ee web-app_2_4.xsd " Version = "2.4"> servlet> servlet-maping> web-app> 4. Start the Tomcat server, enter "http:// localhost: 8080 / tomcatsample / servletsample" in the browser window 6. Debug the servlet program 1. Add a breakpoint to the servletsample.java file, as shown in the figure: 2. Refresh the browser window and switch to the "debug" view of Eclipse, change as follows: 3. At this point, the browser window is as follows: 7. Discuss the mechanism 1. In the Tomcat Directory / Conf / Server.xml file, or there is a TomcatSample.xml file in Tomcat Directory / Catalina / LocalHost, which should be included in these two files: (Note that the above statement will be different due to the different directories of Eclipse.) 2. Enter: "http: // localhost: 8080 /", click on the "Tomcat Manager" link on the left, one window will pop up, let you enter the username and password, in the second largest "environment configuration" In the third section of the medium, you have added a user to the Tomcat management interface, enter this user's username and password, here is "admin", "javamxj". 3. After entering the correct username and password, you will enter the Tomcat management interface, you can see that TomcatSample is running. You can stop, overload, or uninstall it. 4. Uninstall the Context definition from Eclipse now Right-click Tomcatsample Directory -> Tomcat Project-> Remove Context Difinition, as shown below: 5. When you refresh the browser window of the Tomcat management interface, you will find that "/ tomcatsample" has disappeared. at the same time, " 6. To re-add "/ tomcatsample" to the Tomcat application, you need to right-click the TomcatSample directory-> Tomcat Project-> Update Context Difinition, then restart Tomcat. So much, mainly for the next article, "How to use the Lomboz plug-in compile JSP" to make a paving, but also to better understand the use of this plugin. Copyright Notice: 9CBS is this BLOG managed service provider. If this paper involves copyright issues, 9CBS does not assume relevant responsibilities, please contact the copyright owner directly with the article Author. [ Click here to favor this article] Published on October 18, 2004 2:09 PM HREF = "http://blog.9cbs.net/javamxj/services/pingback.aspx" Rel = "pingback" /> Comments 2004-10-19 10:15 PM Good Thanks, I hope that the next thing can come out! 2004-10-21 9:20 am Helios Don't do this, don't you have it? Remote Debug. 2004-10-21 9:42 AM Liao Shihu Write well! Always support! 2004-10-21 4:27 PM ABC Good! Thanks! 2004-10-28 4:17 PM Bulain Write a good, thank you very much! 2005-01-09 10:06 AM Creasy This step in servlet is pulled out: 3. Create a web.xml file in the web-inflicity, save the file. Jumping out of the browser at a construction XML file, saying that a lot of words cannot be displayed 2005-02-03 11:23 AM Liu Why is my Tomcat launch report serious error? 2005-02-13 3:04 PM ERIC Some of these tutorials have also been seriously seen seriously, but after reading it, I really say it is very good as if I have more people, help very much, and so good? I really want to ask those people who say that you have learned from middle school? "Look at the Tiger Cat" meaningful? Please allow me to say this word here, because the author is indeed a good person, seriously written so much, but I have done it, what can you learn? What will you do? Don't you have a few buttons. What about the principle? Slightly actually, even if it is a small project for a message? Only impetuous talents are calling melumara after I know that the skin is known. Please, in the future, ask the author's actuality, principles. Just screaming, I think it is also a sense of misleading for the author! N Multiple loose small examples are not as basic, even if it is a small project tutorial. I am looking forward to the authors have such a tutorial. Come here! 2005-02-14 5:49 PM to study hard First of all, I wish you all a happy New Year ~! Next is the problem: I have recently configured an environment of Eclipse plus Tomcat plugin. The environment is equipped, but when I debug, I found a question. When I pressed F6 at the debug window, when I wanted to follow up, the window automatically turned to the Java Perspective window, and the curst is in the Editor window. In this case, I press F6 in this window that there is no effect. I have to switch to the debugentve window every time I press F6. It is really hard, I want to ask, where is everyone configures this Debug mode, thank you. 2005-02-28 12:27 AM Visual --------------------------------------------- These tutorials I also have seen it seriously, but I will think about it after reading it, I am so good if I have a lot of people, help very much, and so good? I really want to ask those people who say that you have learned from middle school? "Look at the Tiger Cat" meaningful? Please allow me to say this word here, because the author is indeed a good person, seriously written so much, but I have done it, what can you learn? What will you do? Don't you have a few buttons. What about the principle? Slightly actually, even if it is a small project for a message? Only impetuous talents are calling melumara after I know that the skin is known. Please, in the future, ask the author's actuality, principles. Just screaming, I think it is also a sense of misleading for the author! N Multiple loose small examples are not as basic, even if it is a small project tutorial. I am looking forward to the author has such a tutorial ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ --- I don't agree with you. In fact, from these tutorials, it can be said to be the best textbook of entry. If a beginner is indispensable, even a practical environment is not, how to learn Java more practical, principle. In fact, we don't have to learn what, just starting to be embarrassed, it is, it is a reference example to learn grammar, yes. Therefore, the article of the landlord I think it is just a long drought, let me have left many detours, saving a lot of time. thanks landlord. Of course, I hope that the landlord can introduce some experiences and secrets of some project development. Let me wait for the introduction to the introduction as soon as possible, huh, I am consistent with Mr. Eric. Thank you, the landlord and EricGood Thanks, I hope that the next thing can come out! 2004-10-21 9:20 am Helios Don't do this, don't you have it? Remote Debug. 2004-10-21 9:42 AM Liao Shihu Write well! Always support! 2004-10-21 4:27 PM ABC Good! Thanks! 2004-10-28 4:17 PM Bulain Write a good, thank you very much! 2005-01-09 10:06 AM Creasy This step in servlet is pulled out: 3. Create a web.xml file in the web-inflicity, save the file. Jumping out of the browser at a construction XML file, saying that a lot of words cannot be displayed 2005-02-03 11:23 AM Liu Why is my Tomcat launch report serious error? 2005-02-13 3:04 PM ERIC Some of these tutorials have also been seriously seen seriously, but after reading it, I really say it is very good as if I have more people, help very much, and so good? I really want to ask those people who say that you have learned from middle school? "Look at the Tiger Cat" meaningful? Please allow me to say this word here, because the author is indeed a good person, seriously written so much, but I have done it, what can you learn? What will you do? Don't you have a few buttons. What about the principle? Slightly actually, even if it is a small project for a message? Only impetuous talents are calling melumara after I know that the skin is known. Please, in the future, ask the author's actuality, principles. Just screaming, I think it is also a sense of misleading for the author! N Multiple loose small examples are not as basic, even if it is a small project tutorial. I am looking forward to the authors have such a tutorial. Come here! 2005-02-14 5:49 PM to study hard First of all, I wish you all a happy New Year ~! Next is the problem: I have recently configured an environment of Eclipse plus Tomcat plugin. The environment is equipped, but when I debug, I found a question. When I pressed F6 at the debug window, when I wanted to follow up, the window automatically turned to the Java Perspective window, and the curst is in the Editor window. In this case, I press F6 in this window that there is no effect. I have to switch to the debugentve window every time I press F6. It is really hard, I want to ask, where is everyone configures this Debug mode, thank you. 2005-02-28 12:27 AM Visual