Just a few comments

jabber (jabber)
本文发表在 rolia.net/zh 相约加拿大网上社区枫下论坛
1) You never run servlets in browsers. You saying of running servlets in browser is incorrect. We run servlets on the server, and use the browser to observe the effects.

2) If you want to generate the HTML stuff, web pages, your servlet should extend javax.servlet.http.HttpServlet. Then, you need to extend doGet() or doPost(), or both of them. javax.servlet.GenericServlet is generally used to do some tasks behind the curtain, not for generating html stuff.

3) I suggest you look through all the files under C:\jakarta-tomcat\webapps\example. In particular, look into C:\jakarta-tomcat\webapps\example\WEB_INF\web.xml,
in wich you can learn how to configure servlets.

4) In Tomcat, there are several "Contexts". If
your context is named chengdu, it means there is C:\jakarta-tomcat\webapp\chengdu.
For this context, its servlet context is C:\jakarta-tomcat\webapps\chendu\WEB_INF\classes\.
Now if your servlet is called com.abc.greeting.Hello, the class file should stay at C:\jakarta-tomcat\webapps\chengdu\WEB-INF\classes\com\abc\greeting\Hello. To access this servlet, you should hit If you think this URL is ugly-looking, you should edit C:\jakarta-tomcat\webapps\chengdu\WEB-INF\web.xml to give this servlet a better-looking name.
Yoou may compare what I said here to the examples in tomcat.

5) It seems that you have not used the user manual in the tomcat. If you look into the manual in detail, you would have saved a lot of time on guessing work.
更多精彩文章及讨论,请光临枫下论坛. 网址: rolia.net/zh
2000-11-13 -04:00
This post has been archived. It cannot be replied.
Page address has been copied. To share, click to copy page address.
Share Online by QR Code

Back To Topic: hi,Japper, what's about error 500?

Back To Forum: HOME枫下论坛枫下论坛主坛工作学习IT技术讨论