avatar
Run Servlet with Tomcat# Java - 爪哇娇娃
j*1
1
发信人: mitbbs (未名空间), 信区: Complain
标 题: Re: [投诉]Trustinjesus版主dignity滥用权力任意删贴
发信站: BBS 未名空间站 (Tue Jun 21 03:46:35 2011, 美东)
处理结果
若未违反版规,且并未涉及攻击,应允许其存在和正常讨论
avatar
h*m
2
Hi guys,
I installed tomcat 4,the server works fine (shows up the test page),and the
servlet code compiles, but I can't load it with local:8080
That's what I did:create a directory of 'classes' under
webapps/Root/WEB-INF/,then put my .class file there,but when I tried
http:localhost:8080/servlet/HelloWorld, it doesn't load,always shows up
....file not available, seems I put the .class into a wrong place.
What's wrong with it?
Thanks.
avatar
s*g
3
have you enable root context?
also make reloadable = true.

【在 h******m 的大作中提到】
: Hi guys,
: I installed tomcat 4,the server works fine (shows up the test page),and the
: servlet code compiles, but I can't load it with local:8080
: That's what I did:create a directory of 'classes' under
: webapps/Root/WEB-INF/,then put my .class file there,but when I tried
: http:localhost:8080/servlet/HelloWorld, it doesn't load,always shows up
: ....file not available, seems I put the .class into a wrong place.
: What's wrong with it?
: Thanks.

avatar
s*d
4
better setup it in the web.xml using something like below

HelloWorldExample
HelloWorldExample



HelloWorldExample
/HelloWorldExample


the

【在 s*******g 的大作中提到】
: have you enable root context?
: also make reloadable = true.

avatar
y*a
5
Actually, you can save your own servlet files in any directory you like. But
you need configerate the server.xml file under conf dir to tell your tomcat
server where your application. Following is an example:
debug="0" privileged="true">

where path is the path for URL, and docBase is for your working directory on
your machine. So after you add above to server.xml, the URL would be
http://localhost:8080/w

【在 h******m 的大作中提到】
: Hi guys,
: I installed tomcat 4,the server works fine (shows up the test page),and the
: servlet code compiles, but I can't load it with local:8080
: That's what I did:create a directory of 'classes' under
: webapps/Root/WEB-INF/,then put my .class file there,but when I tried
: http:localhost:8080/servlet/HelloWorld, it doesn't load,always shows up
: ....file not available, seems I put the .class into a wrong place.
: What's wrong with it?
: Thanks.

avatar
h*m
6

well, which web.xml should I do? There is one in /conf, and others somewhere
else.
I did make these changed in server.xml and web.xml under the conf,seems not
help...Shall I try these in the webadv/...?
Thanks.

【在 s****d 的大作中提到】
: better setup it in the web.xml using something like below
:
: HelloWorldExample
: HelloWorldExample
:

:
:
: HelloWorldExample
: /HelloWorldExample
:

avatar
y*a
7
each project has its own web.xml. So if you save your servlet under
webapps/Root, then you need modify the web.xml under webapps/Root/WEB-INF

【在 h******m 的大作中提到】
:
: well, which web.xml should I do? There is one in /conf, and others somewhere
: else.
: I did make these changed in server.xml and web.xml under the conf,seems not
: help...Shall I try these in the webadv/...?
: Thanks.

avatar
b*e
8
Here comes the link of authority.
http://www.moreservlets.com/Using-Tomcat-4.html
Be aware that TOMCAT 4 is different than Tomcat 3. If you set up
you own app directory under webapps, all the classes that you create
must be in a package.

【在 h******m 的大作中提到】
: Hi guys,
: I installed tomcat 4,the server works fine (shows up the test page),and the
: servlet code compiles, but I can't load it with local:8080
: That's what I did:create a directory of 'classes' under
: webapps/Root/WEB-INF/,then put my .class file there,but when I tried
: http:localhost:8080/servlet/HelloWorld, it doesn't load,always shows up
: ....file not available, seems I put the .class into a wrong place.
: What's wrong with it?
: Thanks.

相关阅读
logo
联系我们隐私协议©2024 redian.news
Redian新闻
Redian.news刊载任何文章,不代表同意其说法或描述,仅为提供更多信息,也不构成任何建议。文章信息的合法性及真实性由其作者负责,与Redian.news及其运营公司无关。欢迎投稿,如发现稿件侵权,或作者不愿在本网发表文章,请版权拥有者通知本网处理。